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

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

执行下列程序段后,i的正确结果是() int i=9; switch(i) { case 9:i+=1; case 10:i++;break; case 11: ++i;break; default:i+=i;break; }

A.9

B.10

C.11

D.24


参考答案和解析
形成死循环
更多 “执行下列程序段后,i的正确结果是() int i=9; switch(i) { case 9:i+=1; case 10:i++;break; case 11: ++i;break; default:i+=i;break; }A.9B.10C.11D.24” 相关考题
考题 以下程序的运行结果是 【 9 】 。main( ){ int a=2,b=7,c=5;switch(a0){ case 1:switch(b0){ case 1: printf ("@"); break;case 2: printf("!"); break;}case 0: switch(c==5){ case 0 : printf (" * "); break;case 1 : printf(" # "); break;case 2: printf(" $ "); break;}default : printf("");}printf("\n");}

考题 以下程序:main(){charc;inti;for(i=65;i68;i++){c=i+32;switch(c){case‘a’:printf(“%c,“,c);break;case‘b’:case‘e’:printf(“ok,“);default:printf(“end“);}}}的输出结果为() A、a,ok,endB、a,ok,endendC、a,ok,end,endD、a,ok,ok

考题 有以下程序#include stdio.hmain(){ int a[ ]={2,3,5,4},i;for(i=0;i4;i++)switch(i%2){ case 0:switch(a[i]%2){case 0:a[i]++;break;case 1:a[i]--;}break;case 1:a[i ] =0;}for(i=0;i4;i++) printf("%d",a[i]); printf("\n");}程序运行后的输出结果是A)3 3 4 4B)2 0 5 0C)3 0 4 0D)0 3 0 4

考题 下列程序的输出结果是______。 main() { int i=3; switch(i) { case 1: case 2:printf("%d",i); case 3: case 4:break; default:printf("OK"); } }A.0B.3C.OKD.没有任何输出

考题 请补充函数fun(),该函数的功能是:分类统计一个字符串中元音字母和其他字符的个数(不区分大小写)。例如,输入aeiouAOUpqn,结果为A∶2 E∶1 1∶1 O∶2 U∶2 Other∶4。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include<stdiO.h>include<conio.h>define N 100void fun(char *str,int bb[ ]){char *p=str;int i=0;for(i=0;i<6;i++)【 】;while(*p){switch(*p){case 'A':case 'a':bb[0]++;break;case 'E':case 'e':bb[1]++;break;case 'I':case 'i':bb[2]++;break;case 'O':case 'o':bb[3]++;break;case 'U':case 'u':bb[4]++;break;default:【 】;}【 】}}main(){char str[N),ss[6]="AEIOU";int i;int bb[6];clrscr();printf("Input a string:\n");gets(str);printf("the string is:\n");puts(str);fun(str,bb);for(i=0;i<5;i++)printf("\n%c:%d",ss[i],bb[i]);printf("\nother:%d",bb[i]);}

考题 下列给定函数中,函数fun()的功能是:统计字符串中各元音字母(即A,E,I,O,U)的个数。注意:字母不分大小写。例如,输入THIs is a boot,则应输出是1 0 2 2 0。请改正程序中的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。试题程序:include <conio.h>include <stdio.h>/*************found**************/fun(char *s, int num[5]){ int k, i=5;for(k=0;k<i;k++)/*************found**************/num [i]=0;for{;*s;s++){ i=-l;/*************found**************/switch(s){ case 'a': case 'A':{i=0;break;}case 'e': case 'E':{i=1;break;}case 'i': case 'I':{i=2;break;}case 'o': case 'O':{i=3;break;}case 'u': case 'U':{i=4;break;}}if(i>=0)num[i]++;}}main ( ){ char s1[81]; int num1[5], i;clrscr ();printf("\nPlease enter a string: ");gets (s1);fun{s1, num1);for(i=0;i<5;i++) printf("%d",num1[i]);printf ("\n");}

考题 有以下程序 main( ) { int i; for(i=0;i<3;i++) switch(i) { case 1: printf("%d",i); case 2: printf("%d",i); default: printf("%d",i); } } 执行后输出的结果是A.11122B.12C.12020D.120

考题 下列程序的输出结果是()。includemain(){int a=0,i; for(i=1;i 下列程序的输出结果是( )。 #include<stdio.h> main() { int a=0,i; for(i=1;i<5;i++) { switch(i) { case 0: case 3:a+=1; case 1: case 2:a+=2; default:a+=3; } printf("%d",A) ; }A.19B.18C.6D.8

考题 以下程序的输出结果是()。includevoid main(){int a(5),b(6),i(0),j(0);switch(a) { 以下程序的输出结果是( )。 #include<iostream.h> void main() { int a(5),b(6),i(0),j(0); switch(a) { case 5:switch(b) { case 5:i++;break; case 6:j++;break; default:i++;j++; } case 6:i++; j++; break; default:i++;j++; } cout<<i<<","<<j<<endl; }A.1,2B.1,3C.2,2D.2,3

考题 下列程序的输出结果是______。 main() { int i=3; switch(i) { case1: case2:printf("%d",i); case3: case4:break; default: printf ("OK"); } }A.0B.3C.OKD.没有任何输出

考题 下列程序的运行结果为【】。 include void main(void) {int i=10;switch(i){case 9:i=i 下列程序的运行结果为【 】。include<iostream.h>void main(void){int i=10;switch(i){ case 9:i=i+1;case 10:i=i+1;case 11:i=i+1;default:i=i+1;}cout<<i<<endl;}

考题 以下程序执行后的输出结果是【】。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;}

考题 请补充main函数,该函数的功能是:从字符串str中取出所有数字字符,并分别计数,然后把结果保存在数组b中并输出,把其他字符保存在N[10]中。例如:当str1=“ab123456789cde090”时,结果为:0: 2 1: 1 2: 1 3: 1 4: 1 5: 1 6: 1 7: 1 8: 1 9:2 other charactor:5注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include <stdio.h>include <conio.h>main(){int i,b[11];char *str="abl23456789cde090";char *p=str;clrscr();printf("***the origial data ***\n");puts(str);for(i=0;i<11;i++)b[i]=0;while(*p){switch(【 】){case '0':b[0]++;break;case '1':b[1]++;break;case '2':b[2]++;break;case '3':b[3]++;break;case '4':b[4]++;break;case '5':b[5]++;break;case '6':b[6]++;break;case '7':b[7]++;break;case '8':b[8]++;break;case '9':b[9]++;break;【 】}【 】}printf("****** the result ********\n");for(i=0;i<10;i++)printf("\n%d:%d",i,b[i]);printf("\nother charactor:%d",b[i]);}

考题 假定输入的10个整数为:32,64,53,87,54,32,98,56,98,83。那么下列程序的运行结果是【 】。include <iostream>using namespace std;int main(){int a,b,C,X;a = b = C = 0;for(int i = 0;i<10;i++){cin>>x;switch(x%3){case 0 :a+=x; break;case 1 :b+=x; break;case 2 : C+=x; break;}}cout<<a<<","<<b<<","<<C<<end1;return 0;}

考题 已知C源程序如下: include include void reverse(char S[]){ int C,i,J; f 已知C源程序如下:include<stdio. h>include<string. h>void reverse(char S[]){int C,i,J;for(i=0,j=strlen(s)-1;i<j;i++,j++){c=s[i];s[i]=s[j];s[j]=c;}}void getHex(int number,char s[]){int I;i=0;while(number>0){if(number%16<10)s[i++]=number%16+'0';elseswitch(number%16){case 10:s[i++]='A';break;case 11:s[i++]='B';break;case 12:s[i++]='C';break;case 13:s[i++]='D';break;case 14:s[i++]='E';break;case 15:s[i++]='F';break;default:printf("Error");break;}number/=16;}s[i]:'\o';reverse(s);}int main(){unsigned int number;int i=0:char s[50];printf("%s","please input number;\n");scanf("%d",&number):getHex(number,s);i=0;while(s[i])printf("%c",s[i++]);return 0;}画出程序中所有函数的控制流程图。

考题 下面程序的运行结果是( )。 define P(A)printf("%d",A)main() {int j,a[]={1,2,3,4,5,6,7},i=5; for(j=3;j>1;j--) {switch(j) {case 1: case 2:P(a[i++]);break; case 3:P(a[--i]); } } }

考题 下列程序的输出的结果是______。 public class exl6 { public static void main(String[] args) { int j=10; for(int i=0;i<3;i++) { j-=i+1; switch (j){ case 3: break; case 5: break; case 8: break; default: j=0;break; } } System,out.println(j); } }A.5B.3C.8D.0

考题 以下程序的输出结果是()。includemain(){int a,i;a=0; for(i=1;i 以下程序的输出结果是( )。 #include <stdio.h> main() { int a,i;a=0; for(i=1;i<5;i++) { switch(i) { case 0: case 3:a+=2; case 1: case 2:a+=3; default:a+=5; } } printf("%d\n",a); }A.31B.13C.10D.20

考题 下面这段代码有错误么?switch (i){case():CaseZero();break;case 1:CaseOne();break;case 2:dufault;CaseTwo();break;}

考题 以下程序运行后的输出结果是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);}

考题 下列程序的输出结果是【】。 include void main() { inta(5),b(6),i(0)1j(0); switch(a 下列程序的输出结果是【 】。include<iostream.h>void main(){inta(5),b(6),i(0)1j(0);switch(a){case 5:switch(b){case 5:i++;break;case 6:j++;break;defaun:i++;j++;}case 6:i++;j++;break;default:i++;j++;}cout<<i<<","<<j<<endl;}

考题 有以下程序:includemain(){int a=6,b=7,m=I;switch(a%2){case 0:m++;break;case 1:m++ 有以下程序: #include<stdio.h> main() {int a=6,b=7,m=I; switch(a%2) {case 0:m++;break; case 1:m++; switch(b%2) {defaut:m++; case 0:m++;break; } } printf("%d\n",m); } 程序运行后的输出结果是( )。A.1B.2C.3D.4

考题 下面程序段的输出结果是( )。 public class Test{ public static void main(String args[]){ int i=1: switch(i){ case0: System.OUt.println("0"); break; casel: System.out.println("1"); case2: System.OUt.println("2"); break; default: System.out.println("default"); } } }A.01B.12C.10D.21

考题 有以下程序 #includestdi0.h main( ) {int a[]={2,3,5,4),i; for(i=0;i4;i++) switch(i%2) {case 0:switch(a[i]%2) {case 0:a[i]++;break; case l:a[i]--; }break; case1:a[i]=0; } for(i=0;i4;i++)printf("%d",a[i]);printf("\n"); } 程序运行后的输出结果是( )。A.3344B.2050C.3040D.0304

考题 下列程序的输出结果是_______。 main() { int i=3; switch(i) { case1: case 2:printf("%d",i) case 3: case 4:break; default : printf("OK") } }A.0B.3C.OKD.没有任何输出

考题 以下程序的输出结果为()。main( ){ char c;int i;for(i=65;i68;i++){ c=i+32;switch(c){ case 'a':case 'b':case 'c':printf("%c,",c);break; default:printf("end");}}}A a,b,c,endB a,a,a,endC a,a,a,D a,b,c,

考题 #includemain(){ char str[ ]=“The C program”,c;int i;for(i=2;(c=str[i])!=‘\0’;i++){ switch(c){ case ‘g’: ++i; break;case ‘o’: continue;default: printf(“%c”,c); continue;}printf(“*”);}printf(“\n”);}

考题 单选题有以下程序:#include main(){ int a[]={2,3,5,4},i; for(i=0;i4;i++) switch(i%2) {  case 0:      switch(a[i]%2)      {       case 0:a[i]++;break;       case 1:a[i]--;      }break;  case 1:a[i]=0; } for(i=0;i4;i++)printf(%d,a[i]); printf();}程序运行后的输出结果是(  )。A 3344B 2050C 3040D 0304