网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
有以下程序:includeincludeusing namespace std;int main(){fstream file;fi

有以下程序:

include<iostream>

include<fstream>

using namespace std;

int main()

{

fstream file;

file.open("abc.txt", ios :: in);

if ( !file )

{

cout<<"Can not open abc.txt"<<end1;

abort();

}

char buf[ 80 ];

int i = 0;

while (!file.eof())

{

file.getline(buf,80);

i++;

}

cout<<"Lines :"<<i<<end1;

file.close();

return 0;

}

程序实现的功能是【 】。


参考答案

更多 “ 有以下程序:includeincludeusing namespace std;int main(){fstream file;fi 有以下程序:include<iostream>include<fstream>using namespace std;int main(){fstream file;file.open("abc.txt", ios :: in);if ( !file ){cout<<"Can not open abc.txt"<<end1;abort();}char buf[ 80 ];int i = 0;while (!file.eof()){file.getline(buf,80);i++;}cout<<"Lines :"<<i<<end1;file.close();return 0;}程序实现的功能是【 】。 ” 相关考题
考题 以下程序执行后输出的结果是【】。 include include using namespace std; int 以下程序执行后输出的结果是【 】。include<iostream>include<fstream>using namespace std;int main(){ofstream ofile("D:\\temp.txt");if(!ofile){cout<<"temp.txt cannot open"<<endl;return 0;}ofile<<"This is a book" <<" " <<54321<<endl;ofile.close();ifstream ifile("D:\\temp.txt");if(!ifile){cout<<"temp.txt cannot open" <<endl;return 0;}charstr[40];ifile >> str;ifile.close();cout<<Str<<endl;return 1;}

考题 下面程序的预设功能是:统计文件abc.txt中的字符个数。 include include 下面程序的预设功能是:统计文件abc.txt中的字符个数。include <iostream.h>include <fstream.h>include <stdlib.h>void main(){fstream file;file.open( "abc.txt", ios::in);if ( !file ){cout<<"Can not open abc.txt"<<end1;abort();}char ch;int i = O;while (______________){file.get(ch);i++;}cout<<"Characters : "<<i<<end1;file.close();}则程序中空白处应该填入的语句是【 】。

考题 执行如下程序后的输出结果是【】。include include using namespace std;int ma 执行如下程序后的输出结果是【 】。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");

考题 有以下程序: include include include intmain() {fstreamfil 有以下程序:include <iostream.h>include <fstream.h>include <stdlib.h>int main(){fstream filel,file2;char line[100];filel.open("source.txt",ios::in);if(!file1){cout<<"Can't open file source.txt!"<<end1;abort();}file2.open("dest.txt",ios::out);if(!file2){cout<<"Can't open file dest.txt!"<<end1;abort();}while(!file1.eof()){filel.getline(1ine,100);file2<<line;file2<<end1;}filel.close();file2.close();return 0;}此程序实现的功能是【 】。

考题 下列程序完成从文件读取文件显示的同时写入第二个文件,则在程序中划线部分应该出现的语句是______。include<iostream.h>include(fstream.h)void main(){fstream filel,file2;charfnl[10],fn2[10],ch;cout<<“输入源文件名”;cin>>fnl;cout<<“输入目标文件名”;cin>>fn2;filel.open(fnl,ios::i

考题 以下程序的执行结果是【】。 include include include int ma 以下程序的执行结果是【 】。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

考题 以下程序的执行结果是_______。 include include include void 以下程序的执行结果是_______。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

考题 有以下程序: include include using namespace std; int main () {char ch[] 有以下程序:include <fstream>include <string>using namespace std;int main (){char ch[] = "The end";ofstream outstr( "d:\\put.txt", ios_base: :app);for (int i = 0; i < strlen( ch ); i++ )outstr.put(ch[i]);outstr.close();return 0;}程序实现的功能是【 】。

考题 有以下程序:include include using namespace std;int main ( ){ ofstream 有以下程序: #include <iostream> #include <fstream> using namespace std; int main ( ) { ofstream ofile; char ch; ofile.open ("abc.txt"); cin>>ch; while (ch!='#' ) { cin>>ch; ofile.put(ch);A.程序编译时出错B.abc#C.abcD.#