执行如下程序后的输出结果是【 】。
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");
第1题:
有如下程序: #include <iostream> void fun(int& x, int y){int t=x;x=y;y=t;} int main () { int a[2]={23,42}; fun(a[1],a[0]); std::cout<<a[0]<<","<<a[1]<<std::endl; return 0; } 执行后的输出结果是
A.42,42
B.23,23
C.23,42
D.42,23
第2题:
以下程序的执行结果是【 】。
include <iostream.h>
include <fstream.h>
include <stdlib.h>
int main()
{
fstream outfile, infile;
outfile.open("D:\\text.dat",ios::out);
if(!outfile)
{
cout<<"text.dat can't open"<<end1
第3题:
以下程序执行后的输出结果是 #include<iostream>. using namespace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第4题:
如下程序的输出结果是 #include<iostream> void fun(int & X,inty){intt=x;x=y;y=t;} int main( ){ int a[2]={23,42}; fun(a[1],a[0]); std::cout<<a[0]<<","<<a[1]<<std::endl; return 0; }
A.42,42
B.23,23
C.23,42
D.42,23
第5题:
以下程序的执行结果是_______。
include<iostream.h>
include<fstream.h>
include<stdlib.h>
void main()
{
char ch:
fstream file:
file.open("abc.dat",ios::out1ios::inlios::binary);
if(! file)
{
cout<<“abc.dat文件不能打开”<<endl:
abort