填空题

下面程序的预设功能是:将文本文件readme 中的内容读出,显示在屏幕上。
#include <fstream>
using namespace std;
int main ()
char buf[ 80 ];
ifstream file( "readme");
while (_______________)

file.getline( buf, 80 );
cout<<buf<<end1;

me. close();
则程序中空白处应填入的语句为 【15】 。

【参考答案】

!file.eof()
<上一题 目录 下一题>
热门 试题

填空题
若有以下程序: #include <iostream> using namespace std; class sample int x; public: sample() void setx(int i) x=i; friend iht fun(sample B[],int n) int m=0; forint i=0;i<n;i++) if(B[i].x>m) m=B[i].x; return.m; ; int main ( ) sample A[10]; int arr[]=90,87,42,78,97,84,60,55,78,65; for(int i=O;i<10;i++) A[i].setx(arr[i]); cout<<fun(A, 10)<<end1; return 0; 该程序运行后的输出结果是 【13】 。
填空题
有以下程序: #include <iostream.h> class A int a; public: A( int i ) a = i; void display() cout<<a; ; class B int b; public: B (int j ) b = j; void display() cout<<b; ; class C : public B, public A int c; public: C(int k) : A( k-2), B(k + 2) c= k; void display() A :: display(); B :: display(); cout<<c; ; int main ( ) C obj ( 10 ); obj.display(); return 0; 执行后的输出结果为 【14】 。
相关试题
  • 在类中定义和实现的函数可以称为 【9】 。