网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

下面程序的功能是从键盘输入的一组字符中统计出大写字母的个数m和小写字母的个数n, 并输出m、n中的较大者,请选择填空: int m=0,n=0; char c; while((__)!='n') { if(c>='A'&& c<='Z') m++ ; if(c>='a'&& c<='z') n++; } printf("%dn",m)

A.scanf("%d",c)

B.getchar()

C.c=getchar()

D.scanf("%c",c)


参考答案和解析
AC。
更多 “下面程序的功能是从键盘输入的一组字符中统计出大写字母的个数m和小写字母的个数n, 并输出m、n中的较大者,请选择填空: int m=0,n=0; char c; while((__)!='n') { if(c>='A' c<='Z') m++ ; if(c>='a' c<='z') n++; } printf("%dn",m)A.scanf("%d",c)B.getchar()C.c=getchar()D.scanf("%c",c)” 相关考题
考题 以下程序中函数 fun 的功能是:统计 person 所指结构体数组中所有性别 (sex) 为 M 的记录的个数 , 存入变量 n 中,并做为函数值返回。请填空:#include stdio.h#define N 3typedef struct{ int num;char nam[10]; char sex;} SS;int fun(SS person[]){ int i,n=0;for(i=0;iN;i++)if( 【 14 】 =='M') n++;return n;}main(){ SS W[N]={{1, "AA", 'F'},{2, "BB",'M'},{3,"CC", 'M'}}; int n;n=fun(W); printf("n=%d\n",n);}

考题 以下程序的功能是 : 通过函数 func 输入字符并统计输入字符的个数 。 输入时用字符 @ 作为输入结束标志。请填空。#include stdio.hlong 【 14 】 ; /* 函数说明语句 */main(){ long n;n=func(); printf("n=%ld\n",n);}long func(){ long m;for(m=0;getchar()!='@'; 【 15 】 );return m;}

考题 设变量已正确定义 , 以下不能统计出一行中输入字符个数 ( 不包含回车符 ) 的程序段是A)n=0;while((ch=getchar())!='\n')n++;B)n=0;while(getchar()!='\n')n++;C)for(n=0;getchar()!='\n';n++);D)n=0;for(ch=getchar();ch!='\n';n++);

考题 (22)设变量已正确定义,以下不能统计出一行中输入字符个数(不包含回车符)的程序段是A)n=0;while((ch=getchar())!=’\n’)n++; B) n=0;while(getchar()!=’\n’)n++;C)for(n=0; getchar()!=’\n’;n++); D)n=0;for(ch=getchar();ch!=’\n’;n++);

考题 有以下程序: main() {int m=12,n=34; printf("%d%d",m++,++n); printf("%d%d\n",n++,++m); } 程序运行后的输出结果是 ______。A.12353514B.12353513C.12343514D.12343513

考题 下列程序段是从键盘输入的字符中统计数字字符的个数,用换行符结束循环。 Int n=0, ch; Ch=getchar( ); While( __________________ ) { if ( ________________ ) n++; c=getchar( ); }

考题 请补充函数fun(),该函数的功能是:返回字符数组中指定子符的个数,指定字符从键盘输入。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include <stdio.h>define N 80int fun (char s[],char ch){int i=0, n=0;while(【 】){if(【 】)n++;i++;}【 】;}main ( ){int n;char str[N], ch;clrscr ();printf ("\nInput a string: \n");gets (str);printf ("\nInput a charactor: \n" ;scanf ("%c", ch);n=fun (str, ch);printf("\nnumber of %c:%d", ch, n);}

考题 有以下程序 main() { int m,n; printf("Enter m,n:");scanf("%d%d",m,n); while(m!=n) { while(m>n)m-=n; while(n>m)n-=m; } printf("m=%d\n",m); } 如果从键盘上输入65 14<回车>,则输出结果为( )A.m=3B.m=2C.m=1D.m=0

考题 以下程序执行后的输出结果是【】。includemain(){int i, m=0,n=0,k=0;for(i=9;i 以下程序执行后的输出结果是【 】。include<iostream.h>main(){int i, m=0,n=0,k=0;for(i=9;i<= 11 ;i++)switch(i/10){case 0: m++; n++; break;case 10: n++; break;default: k++; n++;}cout<<m<<n<<k;}

考题 下列给定程序中,函数fun()的功能是:从s所指字符串中,找出t所指字符串的个数作为函数值返回。例如,当s所指字符串中的内容为abcdabfab,t所指字符串的内容为ab,则函数返回整数3。请改正程序中的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构.试题程序:include <conio.h>include <stdio.h>include <string.h>int fun (char *s, char *t){int n; char *p, *r;n=0;while(*s){p=s;r=t;while (*r)/**************found**************/if(*r==*p) {r++; p++}else break;/*************found**************/if(r=='\0')n++;s++;}return n;}main(){char s[100], t[100]; int m;clrscr();printf("\nPlease enter string s: ");scanf ("%s",s);printf("\nPlease enter substring t: ");scanf ("%s",t);m=fun (s,t);printf("\nThe result is: m=%d\n", m);}

考题 运行以下程序后,如果从键盘上输入6514,则输出结果为______。 main() { int m,n; printf("En 运行以下程序后,如果从键盘上输入6514<回车>,则输出结果为______。 main() { int m,n; printf("Enter m,n:"); scanf("%d%d",m,n); while(m!=n) { while(m>n)m-=n; while(n>m)n-=m; } printf("m=%d\n",m); }A.m=3B.m=2C.m=1D.m=0

考题 运行以下程序后,如果从键盘上输入65 14,则输出结果为_____。main(){int m,n;printf("Enter 运行以下程序后,如果从键盘上输入65 14<回车>,则输出结果为_____。 main() { int m,n; printf("Enter m,n:"); scanf("%d%d",m,n); while(m!=n) { while(m>n)m-=n; while(n>m)n-=m; } printf("m=%d\n",m); }A.m=3B.m=2C.m=1D.m=0

考题 设有如下程序: #include"stdio.h" main() { char c; int m=0,n=0; while((c=getchar())!='\n') {if(c>='A'c<='Z') m++; else if(c>='a'c<='z')n++;} printf("m=%d,n=%d",m,n);} 如果从键盘上输入:AbCdefGHj<回车>,则程序运行后的输出结果是( )A.m=5,n=4B.m=4,n=5C.m=9,n=0D.无确定值

考题 以下程序的功能是:通过函数func 输入字符,并统计输入字符的个数。输入时用字符@作为输入结束标志。请填空。#include stdio.hlong ; /* 函数说明语句 */main(){ long n; n=func(); printf("n=%ld\n",n);}long func(){ long m; for( m=0; getchar()!=’@’;); retum m;}

考题 有以下程序main() { int m=14,n=24; printf("%d,%d",m++,++n); printf("%d,%d\n",n++,++m); }程序运行后的输出结果是A.15252616 B.14252515 C.14252516 D.14252615

考题 下面程序的功能是求整数m、n的最大公约数,请填空。 main() {int m,n,r; scanf("%d,%d",m,m,n);if(【 】){r=m;m=n;n=r;)while(【 】){ r=m%n;m=n;n=r; }printf("%d",m);}

考题 下列程序中函数fun的功能是:统计person所指结构体数组中所有性别(sex)为M的记录的个数,存入变量n中,并作为函数值返回。请填空。include <stdio.h>define N 3typedef struct{ int num; char nam[10]; char sex;} SS;int fun(SS person[]){ int i,n=0;for(i=0; i<N; i++)if(【 】=='M') n++;return n;}main(){ SS W[N]={{1,"AA",'F'},{2,"BB",'M'},{3,"CC",'M'}}; int n;n=fun(W); printf("n=%d\n", n);}

考题 下面程序的运行结果是( )。 include main() {int a,s,n,m; a=2;s=0;n=1;m=1; while(m 下面程序的运行结果是( )。 include<stdio.h> main() {int a,s,n,m; a=2;s=0;n=1;m=1; while(m<=4){n=n*a;s=s+n;++m;} printf("s=%d",s); }

考题 有以下程序: include main( ){ int m =12,n=34;printf( "% d% d" ,m++ , ++n);printf( 有以下程序: #include <stdio.h>main( ){ int m =12,n=34; printf( "% d% d" ,m++ , ++n); printf("% d% d \n" ,n ++ , ++m); }程序运行后的输出结果是( )。A.12353514B.12353513C.12343514D.12343513

考题 以下程序运行后的输出结果是main{ int i,m=0,n=0,k=0; for(i=9;i=11;i++) switch(i/10) { case 0: m++;n++;break;  case 1: n++;break;  default:k++;n++; } printf("%d %d %d\n",m,n,k);}

考题 下列程序的功能是( )。 main() { static int s[3][3]={1,2,3,4,5,6,7,8,9,),m,n; for(m=0;m<3;m++) { for(n=0;n<=m;n++) printf("%d",s[m][n]);printf("\n'); } }A.输出3×3矩阵的下三角的元素B.输出3×3矩阵的上三角的元素C.输出3×3矩阵的对角线上的元素D.输出3×3矩阵的元素

考题 有以下程序#includestdio.hint f(int m){ static int n=0;n+=m:return n;}main(){ int n=0;printf("%d,",f(++n));printf("%d\n",f(n++));}程序运行后的输出结果是A.1,2B.1,1C.2,3D.3,3

考题 下面程序的功能是()。include include using namespace std;int main (){ in 下面程序的功能是( )。 #include <iostream> #include <string> using namespace std; int main () { int i=1, n=0; char s[80],*p; p=s; strcpy(p,"It is a book.."); for (; *p !=' \0' ;p++) { if(*p=='') i=0; else if (i==0) { n++; i=1; } } cout<<"n=" <<n<<end1; return 0; }A.统计字符串中的单词个数B.统计字符串中的空格个数C.统计字符串中的字母个数D.统计字符串中的全部字符个数

考题 有以下程序: #includestdio.h int f(int m) { static int n=0; n+=m; return n; } main( ) { int n=0; printf("%d,"f(++n)); printf("%d\n",f(n++)); } 程序运行后的输出结果是( )。A.1,2B.1,1C.2,3D.3,3

考题 若有如下程序: sub(int *t,int a[3][4]) { int m,n; for(m=0;m<3;m++) for(n=0;n<4;n++) { *t=a[m][n];t++;} } main() { int*t,s[3][4)={{1,2,3),{4,5,6),{7,8,9}}; t=(int*)malloc(50); sub(t,s); printf("%d,%d\n",t[4],t[7]); } 则程序运行后的输出结果是( )。A.4,7B.4,0C.5,8D.程序错误

考题 试题33有以下程序#include stdio.hint f(int m){ static int n=0;n+=m;return n;}main(){ int n=0;printf(“%d,”, f(++n));printf(“%d\n”, f(n++));}程序运行后的输出结果是()A.1,2B.1,1C.2,3D.3,3

考题 问答题下列给定程序中,函数fun的功能是:从s所指字符串中,找出t所指字符串的个数作为函数值返回。例如,当s所指字符串中的内容为“abcdabfab”,t所指字符串的内容为“ab”,则函数返回整数3。  请改正程序中的错误,使它能得出正确的结果。  注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!/**********code.c**********/#include #include #include #include int fun(char *s, char *t){ int n; char *p, *r; n=0; while(*s) {  p=s;  r=t;  while(*r)   /**********found**********/   if(*r==*p){r++; p++}   else break;  /**********found**********/  if(r=='\0')   n++;  s++; } return n;}void main(){ char s[100],t[100]; int m; system(CLS); printf(Please enter strings:); scanf(%s,s); printf(Please enter substrings:); scanf(%s,t); m=fun(s,t); printf(The result is:m=%d, m);}/**********-code.c**********/

考题 单选题有以下程序:#include int a=2; int f(){ static int n;  int m;  m=n=0;  n++; a++; m++; return m+n+a; }main(){ int k;  for(k=0;k3;k++)  printf(%d, ,f()); printf(); }程序的运行结果是(  )。A 5,6,7,B 5,7,9,C 5,8,11,D 5,5,5,