正在加载图片...
46· C语言程序设计上机指导与同步训练 printf(”暑s\n",s1) #include <stdio. h> #include <string.h> char b[7]={"54da12″ s=10*s+b[i] printf(“号d\n ) 分析结果 运行结果 4.运行以下程序时,从键盘输入ab<CR> def< cr> #include <stdio. h> #define N 6 main( IN J int i=0 for for(主=0;主<N;1++) putchar(c【i]); 分析结果 #include <stdio. h> #include <string.h> main() int⊥=0 char b[] ="aqid",c[10]; whi1e(a[i]!='\0′b[主]1=10′)·46· C 语言程序设计上机指导与同步训练 ·46· printf(“ %s \n” , s1); } 分析结果 运行结果 3. #include <stdio.h> #include <string.h> main() { char b[ 7 ] = { “ 54da12”} ; int i , s=0 ; for ( i =0 ; b [ i ] >=’ 0 ’ && b [ i ]<=’ 9 ’ ;i+ =2) s = 10*s + b [ i ] – ‘ 0 ‘ ; printf ( “ %d \n “ , s ) ; } 分析结果 运行结果 4.运行以下程序时,从键盘输入 ab<CR> c<CR> def<CR> #include <stdio.h> #include <string.h> #define N 6 main( ) { char c[N ] ; int i=0; for ( ; i < N ; c [ i ] = getchar() ,i++) ; for ( i = 0 ; i < N; i+ + ) putchar( c [ i ] ); } 分析结果 运行结果 5. #include <stdio.h> #include <string.h> main() { int i= 0 ; char a [ ] = “abm” ; char b [ ] = “aqid” , c [10] ; while ( a [ i ] != ‘\0’ && b [ i ] != ‘\0’ ) {
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有