在下列# include命令中,正确的一条是 ( )
A.# include [string.h]
B.# include {math.h}
C.# include(stdio.h)
D.# include<stdio.h>
第1题:
设已执行预编译命令#include<string.h>,以下程序段的输出结果是 char s[]=" an apple" ; printf("%d\n",strlen(s));
A.7
B.8
C.9
D.10
第2题:
下列程序的输出结果是【 】。
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;
}
第3题:
下列程序的输出结果是______。
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;
}
第4题:
以下程序的运行结果是______。
include<iostream.h>
include<math.h>
template<class T>
class TAdd//定义类模板TAdd,T为类型
{
Tx,y;
public:
TAdd (Ta,Tb) {x=a,y=b;) //构造函数
Tadd() { retum x+y;}//成员函数
};
void main( )
{
TAdd<int>A (5,6);
第5题:
下列程序的运行结果是( )。
#include<stdio.h>
#include<string.h>
main()
{ char*s1="abDuj";
char*s2="ABdUG";
int t;
t=strcmp(s1,s2) ;
printf("%d",t);
}
A.正数
B.负数
C.零
D.不确定的值
第6题:
以下程序的输出结果是【 】。
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;
}
第7题:
A.#include命令中,文件名可以用双引号或尖括号括起来
B.一个被包含文件中又可以包含另一个被包含文件
C.一个#include命令中可以指定多个被包含文件
D.一个#include命令中只能指定一个被包含文件
第8题:
为使*p=20,下面正确的程序是 ( )
A.# include<stdio.h> main( ) { int a=10,b=20,*p=&b; printf("%d\t%d\n",p,*p); } *p)
B.# include<stdio.h> main( ) { int a=10,b=20,*p=b; printf("%d\t\%d\n",p,*p) }
C.# include<stdio.h> main( ) { int a=10,b=20,*p; p=&a; p + +; printf("%d\t\%d\n",p,*p);} }
D.# include<stdio.h> main( ) { int a=10,b=20,*p; *p=20; printf("%d\t\%d\n",p,*p); }
第9题:
下列程序的运行结果为【 】。
include<stdio.h>
include<string.h>
{ int a; char b[10]; double c; };
void f (struct A *t);
main()
{ struct A a={1001,"ZhangDa",1098.0};
f(&a) ; printf("%d,%s,%6.lf\n",a.a,a.b,a.C);
}
void f(struct A*t)
{ strcpy(t->b, "ChangRong");}
第10题:
下列程序的输出结果是( )。 #include<iostream.h> #include"string.h" void main() {char a[]="Hello Test",b[]="Test"; strcpy(a,b); cout<<a<<end1; }
A.Hello
B.Test
C.Hello Test
D.Hello Test HelloTest