The professor thinks that those who are only interested in learning a trade are ____of becoming a new “species.” He calls them ____and ____, meaning uncivilized people, although they may know how to push buttons and run machines.
查看答案
【单选题】若要实现total=1+2+3+4+5求和,以下程序段错误的是( )
A. int i=1,total=1; while(i<5) { total+=i; i+=1;}
B. int i=1,total=0; while(i<=5) { total+=i; i+=1; }
C. int i=0,total=0; while(i<5) { i+=1; total+=i; }
D. int i=0,total=0; while(i<=5) { total+=i; i+=1; }
【单选题】有以下程序 #include main() { int i=1,k=0; for( ; i<6 ; ) { switch(i%3) { case 0: k++; case 1: k++; break; case 2: k++; continue; } i+=1; } printf("%d\n",k); } 程序的运行情况是
A. 形成无限循环
B. 输出6
C. 输出5
D. 输出4
有下列程序 #include main( ) { int a=123456, b; while(a) { b = a%10; a /= 10; switch(b) { default: printf("%d", b++); case 1: continue; case 2: printf("%d", b++); continue; case 3: printf("%d", b++); case 4: printf("%d", b++); continue; } } } 程序执行后的输出结果是()。
A. 654342
B. 234456
C. 1234456
D. 6543421
有以下程序 #include main( ) { int a=-2, b=2; for(; ++a && --b;) printf("%d,%d,", a,b); } 程序执行后的输出结果是()。
A. 0,1,
B. -1,1,0,1,
C. -1,1,0,0,
D. -1,1,