下面程序的运行结果是____________。#include#includemain(){ char s1[20],s2[20]} gets(s1); scanf(“%s”,s2); puts(s1); puts(s2); }运行程序,输入: Thank you! Good morning!
A: Thank you!Good morning!
B: Thank you!Good
A: Thank you!Good morning!
B: Thank you!Good
举一反三
- 下面程序的运行结果是______ 。#include#includemain(){ char s1[20],s2[20]} gets(s1); scanf(“%s”,s2); puts(s1); puts(s2); }运行程序,输入: Thank you! Good morning!
- 有以下程序#include void fun(char *a,char *b){ char *s=a; while(*s) s++; s--; while(s>=a) { *b=*s; s--; b++; } *b=’\0’;}main(){ char s1[]="abc",s2[6]; fun(s1,s2); puts(s2);}程序运行后的输出结果是 A: cbaabc B: abc C: cba D: abccba
- 已有定义char s1,s2[20]; ,下面可以为所定义的变量正确输入数据的语句是( )。 A: scanf ("%c%s", &s1,s2); B: scanf ("%s%c", &s1,s2); C: scanf ("%c%s", &s1,&s2); D: scanf ("%c%s",s1,s2);
- 下面程序的运行结果是:( )。main(){ char s1[20]="Good!"; char s2[15]="AB"; printf("%d",strlen(strcpy(s1,s2)));} A: 20 B: 15 C: 5 D: 2
- 以下程序的输出结果是( )#include ”string.h”main(){ char s1[20]=“bcd”,s2[20]=“abc”;if(strcmp(s1,s2)>0) printf(“%s\n”,s1);else printf(“%s\n”,s2);} A: bcd B: abc C: bcdabc D: abcbcd