更多"下列程序的输出结果为( )。
# include < i"的相关试题:
[单项选择]下面的程序输出结果是( )。 #include<iostream> using namespace std; void add( ) { static int x; x++; cout<<x<<''; } int main( ) { for(int i=0;i<3;i++) add( ); return 0; }
A. 111
B. 123
C. 222
D. 333
[单项选择]下面程序的输出结果是 #include<iostream.h> #include<string.h> void main( ) { char p1[10],P2[10]; strcpy(p1,"abc"); strcpy(p2,"ABC"); char str[50]="xyz"; strcpy(str+2,strcat(P1,p2)); cout<<six; }
A. xyzabcABC
B. zabcABC
C. xyabcABC
D. yzabcABC
[单项选择]下面程序输出结果是 ______。 #include<iostream. h> void main( ){ int a,b,c; a=6;b=c=4; if(a!=B) if(a!=B) if(a) cout<<(a-->2); else a++; else a+=a; cout<<a; }
A. 15
B. 07
C. 12
D. 17
[单项选择]以下程序输出的结果是 #include<stdio.h> #include<string.h> main( ) {charw[][10]={"ABCD","EFGH","IJKL","MNOP"}1,k; for(k=1;k<3;k++) printf("%s/n",&w[k][k]);}
A. ABCD FGH KL
B. ABC EFG U M
C. EFG JK 0
D. FGH KL
[单项选择]以下程序的输出结果是 #include <stdio.h> #include <string,h> main( ) { char b1[8]="abcdefg",b2[8],*pb=b1+3; while (--pb>=b1) strcpy(b2,pB) ; printf("%d/n",strlen(b2)); }
A. 8
B. 3
C. 1
D. 7
[单项选择]以下程序的输出结果是 ( ) #include<stdio.h> #include<string.h> main( ) {char str[12]={'s','t','r','i','n','g'}; printf("%d/n",strlen(str)); }
A. 6
B. 7
C. 11
D. 12
[单项选择]以下程序的输出结果是()。 #include #include main() {charb1[8]="abcdefg",b2[8],*pb=b1+3; while(--pb>=b1)strcpy(b2,pb); printf("%d/n",strlen(b2)); }
A. 8
B. 3
C. 1
D. 7
[单项选择]以下程序输出结果是 ______。 #include<iostream.h> void fun(int x,int y,int z){z=x+y;} void main( ) { int a=10; fun (2,2,a); cout<<a; }
A. 0
B. 4
C. 10
D. 无定值
[单项选择]如下程序的输出结果是 #include<iostream> using namespaee std; int main( ){ eout.fill('*'); eout.width(6); cout.fill('#'): eout<(123<endl: return 0; }
A. ###123
B. 123###
C. ***123
D. 123***
[单项选择]如下程序的输出结果是 #include<iostream> using namespace std; class A{ public: A( ){cout<<"A";} }; class B{public:B( ){cout<<"B";}}; class C://public A{ B b; public: C( ){cout<<"C";} }; int main( ){C obj;return 0;}
A. CBA
B. BAC
C. ACB
D. ABC
[单项选择]以下程序的输出结果是 #include<iostream> using nameSpace std; int main( ) { cout.fill('*'); cout.width(5); cout<<hex<<100<<end1; return 0; }
A. **100
B. ***64
C. 100**
D. 64***
[单项选择]下列程序的输出结果是 #include"iostream" using namespace std; int Max(int a,int b) { if (a > b) return a; else return b; } void main( ) { int m,n; m=10,n=5; int max=Max(m,n); cout<<max<<endl; }
A. 10
B. 程序有误
C. 1
D. 0
[单项选择]下面程序的输出结果是 #include<stdio.h> #include<string.h> main( ) { char*p1="abc",*p2="ABC",str[50]="xyz"; strcpy(str+2,streat(p1,p2)); printf("%s/n",str);}
A. xyzabcABC
B. zabcABC
C. xyabcABC
D. yzabcABC
[单项选择]以下程序运行后的输出结果是 #include #include
main( ) { char str[][20]={'One * World", "One *
Dream!"}, *p=str[1]; printf("%d,", strlen(p));
printf("%s/n", p); }
A. 9,One * World
B. 9,One * Dream
C. 10,One * Dream!
D. 10,One * World
[单项选择]下面程序的输出结果是( )。 #include<iostream.h> #include"stdng.h" void main( ) { char a[]="welcome",b[]="well"; strcpy(a,b); cout<<a<<endl; }
A. wellome
B. wellcom
C. well
D. wellwe
[单项选择]以下程序的输出结果是( )。 #include <stdio.h> #include<string.h> mam( ) { char b1[8]="abcdefg",b2[8],*pb=b1+3; while(--pb>=b1) strcpy(b2,pB) ; printf("%d/n",strlen(b2)); }
A. 8
B. 3
C. 1
D. 7