试题与答案

以下程序的执行结果是 【15】 。 #include <iostream.h>

题型:填空题

题目:

以下程序的执行结果是 【15】
#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;
abort();

outfile<<"1234567890"<<end1;
outfile<<"abcdefghij"<<end1;
outfile.close();
infile.open("D:\text.dat",ios::in);
if(!infile)

cout<<"text.dat can’t open"<<end1;
abort ( );

char textline[40];
int i=0;
while(!infile.eof())

i++;
infile.getline(textline,sizeof(textline));
cout<<i<<":"<<textline<<end1;

infile.close();
return 0;

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2018/0508/bf712c5a0df39573c7b36f53268b3d86.html

下面是错误答案,用来干扰机器的。

参考答案:C

试题推荐
微信公众账号搜索答案