更多"在屏幕上显示REPORT.TXT的文本文件内容( )"的相关试题:
[填空题]下面程序的预设功能是:将文本文件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】 。
[填空题]下面程序的预设功能是:将文本文件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】 。
[填空题]以下程序从名为filea.dat的文本文件中逐个读入字符并显示在屏幕上。请填空。
#include <stdio.h>
main( )
FILE *fp; char ch;
fp= fopen(______);
ch= fgetc(fp);
while(!feof(fp)) putchar(ch); ch=fgetc(fp);
putchar(’/n’); fclose(fp);
[填空题]下列程序从名为filea.dat的文本文件中逐个读入字符并显示在屏幕上。请填空。
#include <stdio.h>
main( )
FILE *fp; char ch;
fp = fopen( );
ch = fgetc(fp);
while(!feof(fp)) putchar(ch); ch=fgetc(fp);
putchar("//n"); fclose(fp);
[多项选择]从a盘根目录下名为"string. txt"的文本文件读取前20个字符组成字符串在屏幕上显示输出。
[填空题]以下程序的功能是从名为filea.dat的文本文件中逐个读入字符并显示在屏幕上。请填空。
majn( )
{ FILE *fp; char ch;
fp=fopen(______);
ch=fgetc(fp);
whle(!feof(fp)) { putchar(ch); ch=f8etc(fp); }
putchar(’/n’); fclose(fp);
}
[填空题]以下程序的功能是从名为filea.dat的文本文件中逐个读入字符并显示在屏幕上。请填空。
majn( )
FILE *fp; char ch;
fp=fopen(______);
ch=fgetc(fp);
whle(!feof(fp)) putchar(ch); ch=f8etc(fp);
putchar(’/n’); fclose(fp);
[填空题]以下程序的功能是从名为filea.dat的文本文件中逐个读入字符并显示在屏幕上。请填空。
#include<stdio.h>
main( )
FILE *fp;char ch;
fp=fopen(______);
ch=fgetc(fp);
whlie(!feof(fp))putchar(eh);ch=fgetc(fp);
putehar("/n");fclose(fp);
[填空题]请补充main 函数,该函数的功能是:把文本文件B中的内容追加到文本文件A的内容之后。
例如,文佃的内容为“I’m ten.”,文件A的内容为“I’ m a student!”,追加之后文件A的内容为“I’m a student !I’m ten.”
注意:部分源程序给出如下。
请勿改动主函数main 和其他函数中的任何内容,仅在函数main 的横线上填入所编写的若干表达式或语句。
试题程序:
# include<stdio, h>
#include<conio. h>
#define N 80
main( )
{
FILE *fp, * fp1, *fp2;
int i;
char c[N] ,t, ch;
clrscr ( );
if ((fp=fopen ("A. dat ", "r") ) == NULL)
{
printf ("file A cannot be opened/n");
exit (0);
}
printf("/n A contents are : /n/n");
for (i=0; (ch=fgetc (fp)) !=EOF; i++)
{
C [i]=ch;
putchar (c [i]);
fclose (fp);
if((fp=fopen ("B. dat", "r") )==NULL)
{
printf ("file B cannot be opened/n");
exit (0);
}
printf("/n/n/nB contents are : /n/n");
for (i=0; (ch=fgetc (fp)) !=EOF; i++)
{
c [i] =ch;
putchar (c [i]);
}
fclose (fp);
if ( (fp1=fopen ("A.dat" ,"a")) 【1】 (fp2
=fopen ("B. dat", "r") ) )
{
while ( (ch=fgetc (f
[填空题]以下程序的作用是:从名为filea.dat的文本文件中逐个读入字符并显示在屏幕上。请填空。
#include <stdio.h>
main( )
FILE *fp; char ch;
fp=fopen(______);
ch=fSetc(fp);
while(!feof(fp)) putchar(ch); ch=fSetc(fp);
putchar(’/n’); fclose(fp);
[填空题]以下程序的作用是:从名为filea.dat的文本文件中逐个读入字符并显示在屏幕上。请填空。
#include <stdio.h>
main( )
{FILE *fp; char ch;
fp=fopen(______);
ch=fSetc(fp);
while(!feof(fp)) { putchar(ch); ch=fSetc(fp); }
putchar(’/n’); fclose(fp);
}
[填空题]以下程序的功能是从名为“filea. dat”的文本文件中逐个读入字符并显示在屏幕上,请填空。
#include<stdio.h>
main( )
FILE *fp; char ch;
fp=fopen( (14) );
ch=fgetc(fp);
while( (15) (fp))putchar(ch); ch=fgetc(fp);
putchar(’/n’); fclose(fp);