程序中头文件typel.h的内容是: #define N 5 #define M1 N*3 程序如下: #include "type1.h” #define M2 N*2 main() { int i; i=M1+M2; printf("%d\n",i);} 程序编译运行后的输出结果是( )
A.10
B.20
C.25
D.30
第1题:
执行如下程序后的输出结果是【 】。
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");
第2题:
程序中头文件type1.h的内容是( )。 #define N 5 #define M1 N*3 程序如下: #define "type1.h" #define M2 N*2 main() { int i; i=M1+M2; printf("%d\n",i); } 程序编译后运行的输出结果是( )。
A.10
B.20
C.25
D.30
第3题:
有如下程序: #include <stdio.h> main() { FILE *fp1; fp1=fopen("f1.txt","w"); fprintf(fp1, "abc"); fclose(fp1); } 若文本文件f1.txt中原有内容为good,则运行以上程序后文件f1.txt中的内容为( )。
A.goodabc
B.abcd
C.abc
D.abcgood
第4题:
有如下程序
#include〈stdio.h〉
main()
{FILE *fp1;
fp1=fopen("f1.txt","w");
fprintf(fp1,"abc");
fclose(fp1);
}
若文本文件f1.txt中原有内容为:good,则运行以上程序后文件f1.txt中的内容为
A.goodabc
B.abcd
C.abc
D.abcgood
第5题:
有如下的程序:
include<iostream>
using namespace std;
class AT{
friend ostream & operator<<(ostream&,AT);
}at;
ostream& operator<<(ostream& os,AT){return os<<'@';}
int main(){
cout<<"MyHome"<<at<<"isHere.com";
}
执行上面的程序将输出
第6题:
有如下程序 #include <stdio.h> main() { FILE *fp1; fp1;fopen("ftxt","w"); fprintf(fpl, "abc") fclose(fpl); } 若文本文件f1.txt中原有内容为:good,则运行以上:程序后文件f1.Mt中的内容为
A.goodabc
B.abcd
C.abc
D.abcgood
第7题:
有如下程序:
include<iostream>
using namespaee std;
class A{
public:
A( ){cout<<"A";}
~A( ){cout<<"A";}
};
class B{
A a;
public:
B( ){cout<<"B";}
~B( )t cout<<"B";}
};
int main( ){
B b;
return 0;
}
程序的输出结果是______。
第8题:
程序中头文件typel.h的内容是 #define N 5 #define M1 N*3 #define "typel .h" #define M2 N*2 main ( ) { int i; i=M1+M2; printf ("%d\n", i ); } 程序编译后运行的输出结果是
A.10
B.20
C.25
D.30
第9题:
有如下程序: #include <stdio.h> main ( ) { FILE* fpl; fp1 = fopen("ftxt" ,"w"); fpfinff( fp1 ," abc" ); fclose ( fp1 ); 若文本文件f1.txt中原有内容为:good,则运行以上程序后文件f1.txt中的内容为( )。
A.goodabc
B.abcd
C.abc
D.abegood
第10题:
下面程序的文件名为t.exe,在DOS下输入的命令行参数如下:t to meet me<回车> 则程序输出的结果是 #include"stdio.h" main(argc,argv) int argc;char*argv[]; { int i; printf("%d\n",argc);}
A.3
B.4
C.2
D.以上答案都不正确
第11题:
4,5,2,4
4,4,2,1
5,5,3,3
4,5,2,3
第12题:
8
9
7
10
第13题:
有如下程序:#include <iostream>#include <iomanip>using namespace std;int main(){cout.fill('*');cout<<left<<setw(4)<<123<< "OK"<<end1;return 0;}执行这个程序的输出结果是( )。
A.123*OK
B.123*OK**
C.*123OK
D.*123**OK
第14题:
程序中头文件type1.h 的内容是#define N 5#define M1 N*3程序如下:#define "type1.h"#define M2 N*2main (){ int i; i=M1+M2; printf("%d\n", i);) 程序编译后运行的输出结果是( )。
A.10
B.20
C.25
D.30
第15题:
有如下程序:
include <iostream>
using namespace std;
class PARENT
{
public:
PARENT() { cout <<"PARENT"; }
};
class SON : public PARENT
{
public:
SON() {cout << "SON"; }
};
int main()
{
SON son;
PARENT *p;
p = &son;
return 0;
}
执行上面程序的输出是______。
第16题:
程序中头文件typel.h的内容是: #define N 5 #define M1 N *3 程序如下: #include“typel.h” #define M2 N*2 main() { int i; i=M1+M2;Printf(“%d\n”,0; } 程序编译后运行的输出结果是:
A.10
B.20
C.25
D.30
第17题:
有如下程序: #include <stdio.h> main() { int x=23; do { Printf("%d",x--);} while(! x); } 该程序的执行结果是( )。
A.321
B.23
C.不输出任何内容
D.陷入死循环
第18题:
如下程序的执行结果是 #include<iostream.h> void main( ) { static int a[ ]={ 1,7,3,9,5,11 }; int * p=a; * (p+3)+=4; cout < < * p < <"," < < * (p+3);}
A.1,13
B.1,16
C.3,13
D.1,14
第19题:
有如下程序: #include <iostream> #include <iomanip> using namespace std; int main() { cout.fill('*'); cout << left << setw(4) << 123 << "OK" << endl; return 0; }
A.123*OK
B.123*OK**
C.*123OK
D.*123**OK
第20题:
有如下程序: #include <iostream> #include <iomanip> using namespace std; int main() { cout.fill('*'); cout.width(6); cout.fill('#'); cout<<123<<end1; return 0; } 执行生的输出结果是( )。
A. ###123
B.123###
C. ***123
D.123***
第21题:
如下程序的运行结果是______。 #include<stdio.h> main() { int x=y=3,z=1; printf ("%d%d\n",(++x,y++),z+2); }
A.3 4
B.4 2
C.4 3
D.3 3
第22题:
对于如下程序: #include
第23题: