第1题:
下列程序执行的输出结果是( )。 #inClUde<stdio.h> main() { char a[2][4]; strcpy(a,"are");strcpy(a[1],"you"); a[0][3]='&'; printf("%s\n",a); }
A.are&you
B.you
C.are
D.&
第2题:
以下程序运行后的输出结果是【 】
include <stdio.h>
main ( )
{ char a[] ="123456789", *p;
int i =0;
p=a;
while( * p)
{ if(i%2 ==0) *p='*';
p++;i++;
}
puts(a);
}
第3题:
以下程序的输出结果是【 】。
include <iostream>
using namespace std;
int main()
{
char S[ ]="abcdef";
s[3]='\0';
cout<<s<<end1;
return 0;
}
第4题:
以下程序的输出结果是【 】。
include<iostream.h>
include <string.h>
void main 0 {
char s[50];
strcpy(&s[O], "No" );
strcpy(&s[1], "123" );
strcpy (&s[2], "23456" );
cout<<s;
}
第5题:
下面程序的输出结果是( )。 include<stdio.h> main() {static char a[]="china"; char*ptr=a; while(*ptr) {printf("%c",*ptr-32); ptr++; } }
第6题:
执行如下程序后的输出结果是【 】。
include <iostream>
include <fstream>
using namespace std;
int main ( )
{
char s[25];
ofstream fl("data.txt");
f1<<"C++ Programming";
f1.close ();
ifstream f2 ("data.txt");
第7题:
执行下列程序的结果是( )。 #include<iostream.h> void main() { char *str; str="test!"; cout<<str[5]; }
A.test!
B.test
C.空字符
D.异常
第8题:
下列程序的输出结果是______。
include<iostream.h>
include<string.h>
using namespace std;
void fun(const char*s,char &C) {c=s[strlen(s)/2];}
int main()
{
char str[]="ABCDE";
char ch=str[1];
fun(str,ch);
cout<<ch;
return 0;
}
第9题:
下面程序运行输出的结果是【 】。
include <iostream>
using namespace std;
int main(){
char a[]="Chinese";
a[3]='\0';
cout<<a<<endl;
return 0;
}
第10题:
下列程序的输出结果是【 】。
include<iostream.h>
include<string.h>
void main(){
char b[30];
strcpy(&b[0],"XY");
strcpy(&b[1],"YZW");
strcpy(&b[2],"ZXY");
cout<<b<<end1;
}