下面程序的输出结果是( )。 #include<iostream> using namespace std; void main() { char cl='a',c2='c'; cout.put('a').put('c').put('\n'); cout.put(c1).put(c2); }
A.ac a c
B.ac ac
C.a c ac c
D.a c
第1题:
程序的输出结果是【 】。
include <iostream>
using namespace std;
class A{
int x;
public:
A(int x=1):x(x){cout<<x;}
};
void main(){
A a,b(2),c(3);
}
第2题:
下面程序的执行结果是______。
include<iostream.h>
include<iomanip.h>
using namespace std;
void main()
{
cout<<setfill('x')<<setw(10);
cout<<"Hello"<<endl;
}
第3题:
下列程序的输出结果是______。
include<iostream>
using namespace std;
void fun(int &rf)
{
rf*=2;
}
int main()
{
int num=500;
fun(num);
cout<<num<<endl;
return 0;
}
第4题:
下面程序的执行结果是【 】。
include<iostream>
include<iomanip>
using namespace std;
void main()
{
cout<<setfill('x')<<setw(10);
cout<<"Hello"<<endl;
}
第5题:
下列程序的输出结果是( )。 #include<iostream> using namespace std; int main() { char a[]="Hello,Test"; char *p=a; while(*p) { if(*p>='a'&&*p<='z') cout<<char(*p+'A'-'a'); else cout<<*p; p++; } return 0; }
A.hello,test
B.Hello,Test
C.HELLO,TEST
D.hELLO,tEST
第6题:
以下程序的输出结果是( )。 #include<iostream> using namespace std; void fun(char**q) { ++q; cout<<*q<<end1; } main() { static char*s[]={"HI","HELL0","TEST"}; char**p; p=s; fun(p); system("PAUSE"); return 0; }
A.为空
B.HI
C.HELL0
D.TEST
第7题:
下列程序的输出结果是【 】。
include<iostream>
include<cstring>
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;
}
第8题:
若有以下程序:
include <iostream>
using namespace std;
int main()
{
char str[10];
cin>>str;
cout<< str<<end1;
return 0;
}
当输入为:
This is a program!
那么执行程序后的输出结果是【 】。
第9题:
下面程序执行的结果是【 】
include<iostream>
using namespace std;
class A{
public:
static int x;
A(inty){cout<<x+y;}
};
int A::x=2;
void main(){
A a(5);
}
第10题:
下面程序的输出结果是( )。 #include <iostream> using namespace std; void main( ) { int i=8,*p=0; p = &i; coat<<p; }
A.0
B.变量i的地址
C.*p=0; 是错误的,因为不可给指针型变量赋予常数值
D.8
第11题:
当输入“d”时(“”代表空格),下列两段程序的输出结果是( )。 #include<iostream> #include<iostream> using namespace std; using namespace std; void main() void main() {char c; {char c; cin>>c;cout<<c;} cin.get(c);cout.put(c);}
A.与d
B.与u
C.d与
D.d与d
第12题:
下面程序的输出结果是( )。 #include<iostream> using namespace std; void main() { int a,b; for(a=1,b=l;a<=100;a++) { if(b>=10) break; if(b%3= =1) { b+=3;continue; } } cout<<a; }
A.101
B.6
C.5
D.4
第13题:
若下面程序运行时输出结果为
1,A,10.1
2,B,3.5
include <iostream>
using namespace std;
int main()
{
void test(int, char, doubie【 】);
test(1, 'A', 10.1 );
test(2, 'B');
return 0;
}
void test(int a, char b, double c)
{
cout<<a<<','<<b<<','<<c<<endl;
}
第14题:
以下程序的输出结果是【 】。
include <iostream>
using namespace std;
void fun()
{
static int a=0;
a+=2;
cout<<a;
}
int main()
{
int CC;
for(CC=1;cc<4;CC++)
fun();
cout<<end1;
return 0;
}
第15题:
下面程序运行输出的结果是【 】。
include <iostream>
using namespace std;
int main(){
char a[]="Chinese";
a[3]='\0';
cout<<a<<endl;
return 0;
}
第16题:
下列程序的输出结果为( )。 #include (iostream) using namespace std; void main( ) char,a[ ] = { "hello" ," the" ," world" }; char * * pa = a: pa + +; cout << * pa << ENDL; }
A.hello
B.the
C.world
D.hellotheworld
第17题:
下面程序输出的结果是( )。 #include <iostream> using namespace std; void swap(int &a,int &b){ int temp; temp=a; a=b; b=temp; } void main(){ int x=2; int y=3; swap(x,y); cout<<x<<y; }
A.23
B.32
C.ab
D.ba
第18题:
下面程序的输出结果是( )。#include <iostream>using namespace std;void main(){int s;for(int k=2;k<6;k+=2)s=1;for(int j=k; j<6;j++) s+=j;cout<<s<<end1;
A.9
B.1
C.11
D.10
第19题:
下面程序输出的结果是( )。 #include<iostream> using namespace std; void main() { char ch[][8]={"good","better","best"}; for(int i=1;i<3;++i) { cout<<ch[i]<<endl; } }
A.good better
B.better best
C.good best
D.good
第20题:
下列程序的输出结果是______。
include <iostream.h>
include <cstring.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,sh);
cout<<Ch;
return 0;
}
第21题:
以下程序的输出结果是( )。 #include<iostream> #include<stdlib> using namespace std; void func(char **m) { ++m; cout<<*m<<endl; } main() { static char *a[]={"MORNING","AFTERNOON","EVENING"); char **n; n=a; func(n); system("PAUSE"); return 0; }
A.为空
B.MORNING
C.AFTERNOON
D.EVENING
第22题:
以下程序的运行结果是【 】。
include<iostream>
include<string>
using namespace std;
void main(){
chara[10]="China",b[]="Chin",c[]="ese";
cout<<strlen(strcat(strcpy(a,b),c))<<endl;
}
第23题:
下面的程序输出的结果是( )。 #include <iostream> using namespace std; void main(){ int a=2; int &c=a; a++; cout<<c; }
A.2
B.3
C.4
D.*a