更多"以下程序: #include<stdio.h> main( ) "的相关试题:
[单项选择]下列程序的输出结果是 #include void main( )
{ char * str="12123434"; int x1=0,x2=0,x3=0,x4=0,i;
for(i=0;str[i]!=’/0’;i++) switch(str[i]) {
case’1’:x4++; case’2’:x3++; case’3’:x2++;
case’4’:x1++; } cout < < x1 < < ","
< < x2 < < "," < < x3 < < "," < < x4;
A. 8,6,4,1
B. 8,6,3,2
C. 8,8,4,1
D. 8,6,4,2
[单项选择]下列程序的输出结果是
#include
void main( )
char * str="12123434";
int x1=0,x2=0,x3=0,x4=0,i;
for(i=0;str[i]!=’/0’;i++)
switch(str[i])
case’1’:x4++;
case’2’:x3++;
case’3’:x2++;
case’4’:x1++;
cout < < x1 < < "," < < x2 < < "," < < x3 < < "," < < x4;
A. 8,6,4,1
B. 8,6,3,2
C. 8,8,4,1
D. 8,6,4,2
[单项选择]有以下程序
#include
main( )
{char c1,c2,c3,c4,c5,c6;
scanf("%c%c%c%C",8az1,&z2,&c3,&c4);
c5=getchar( );c6:getchar( );
putchar(c1);putchar(c2);
printf("%c%c\n",c5,c6);
}
程序运行后,若从键盘输入(从第l列开始)
123<回车>
45678<回车>
则输出结果是【 】。
A. 1267
B. 1256
C. 1278
D. 1245
[填空题]以下程序的输出结果是______。
#include
main( )
char *ch[4]=("red ","green","blue");
int i=0;
while(ch[i])
putchar(ch[i][0]);i++;
[填空题]有以下程序:
main( )
char str[]="xyz", *ps=str;
while(* ps)ps++;
for(ps--; ps-str>=0;ps--)puts(ps);
执行后的输出结果是 【3】 。
[填空题]有以下程序:
main( )
{char str[]="xyz", *ps=str;
while(* ps)ps++;
for(ps--; ps-str>=0;ps--)puts(ps);
}
执行后的输出结果是 【3】 。
[单项选择]
有以下程序
#include
main( )
{ char b,c;int i;
b=’a’; c=’A’;
for(i=0;i<6;i++)
{ if(i%2) putchar(i+B);
else putchar(i+C);
}
printf("/n");
}
程序运行后的输出结果是()。
A. ABCDEF
B. AbCdEf
C. aBcDeF
D. abcdef
[单项选择]有以下程序
#include
main( )
char p[20]=’a’,’b’,’c’,’d’,q[ ]="abc",r[ ]="abcde’;
strcat(p,r) ;strcpy(p+strlen(q),q);
printf("%d/n",strlen(p));
程序运行后的输出结果是
A. 9
B. 6
C. 11
D. 7
[单项选择]有以下程序:
#include
main( )
FILE*pf;
char*s1="China",*s2;"Beijing";
pf=fopen("abc.dat","wb+");
fwrite(s2,7,1,pf);
rewind(pf);/*文件位置指针回到文件开头*/
fwrite(s1,5,1,pf);
fclose(pf):
以上程序执行后abc.dat文件的内容是( )。
A. China
B. Chinang
C. ChinaBeijing
D. BeijingChina
[填空题]当运行以下程序时,输入abcd,程序的输出结果是【 】
insert(char str[])
{int i;
i=strlen(str);
while(i>0)
{str[2*i]=str[i];str[ 2*i-1]=’’*’’;i--;}
printf("%S\n",str);
}
main( )
{char str[40];
scanf("%S",str);insert(str);
}
[填空题]有以下程序:
main( )
char str[]="xyz", *ps=str;
while(* ps)ps++;
for(ps--; ps-str>=0;ps--)puts(ps);
执行后的输出结果是 。
[填空题]当运行以下程序时,输入abed,程序的输出结果是: 【9】 。
insert(char str[])
{int i
i=strlen(str);
while(i>0)
{str[2*i]=str[i];str[2*-1]=’*’;i--; }
printf("%s/n",str);
}
main( )
{char str[40];
scanf("%s",sB) ; insert(str);
}
[填空题]当运行以下程序时,输入abcd,程序的输出结果是 【19】 。
insert(char str[ ] )
int i;
i = stolen(str);
while (i>0)
str[2*i] =str[i]; str[2 * i-1] = ’* ’; i--;
printf( "% s /n", sir);main( )
char str[40];
seanf( "% s" ,str); insert(str);
[填空题]以下程序的输出是 【7】 。
main( )
{
char str1[]=How do you do",*p=strl;
strcpy(str1+strlen(str1)/2"es she");
pfinff("%s/n",p1);
}