写出下列程序的运行结果【 】。 #include <iostream.h>. #include <fstream.h> #include <stdlib.h> void main() { fstream outfile, infile; outfile.

admin2009-01-15  26

问题 写出下列程序的运行结果【  】。
#include <iostream.h>.
#include <fstream.h>
#include <stdlib.h>
void main()
{
fstream outfile, infile;
outfile.open("data.clat", ios:: out);
if(!outfile)
{
cout<<"Can’t open the file."<<end1;
abort();
}
outfile<<" 1234567890"<<end1;
outfile<<"aaaaaaaaa"<<end1;
outfile<<"**********"<<end1;
outfile.close();
infile.open("data. dat ", ios:: in);
if(!infile)
{
cout<<"Can’t open the file."<<end1;
abort();
}
char line[80];
int I=0;
while(!infile. eof())
{
I++;
infile.getline(line, sizeof(line));
cout<<I<<":"<<line<<end1;
}
infile.close();
}

选项

答案1: 1234567890 2:aaaaaaaaa 3:********** 4:

解析
转载请注明原文地址:https://jikaoti.com/ti/6zd0FFFM
0

最新回复(0)