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

题目内容 (请给出正确答案)

请完成下列Java程序。程序的功能是复制文件并显示文件,将每个字符读入,并写入另一个文件,同时显示出来(注意:在本题中,当前目录下的README.txt文件打印在屏幕上,并写入另一个文件temp.txt中)。

注意:请勿改动main()主方法和其他已有的语句内容,仅在下画线处填人适当的语句。

import java.io.*;

public class FileCopyBy{

public static void main(String args[]){

try{

FileReader input=new FileReader("README.txt");

FileWriter utput=new FileWriter("temp.txt");

int c=input.read();

while(__________)

{

__________

System.out.print((char)c);

c=input.read();

}

input.close();

output.close();

}

catch(IOException e)

{

System.out.println(e);

}

}

}


参考答案

更多 “ 请完成下列Java程序。程序的功能是复制文件并显示文件,将每个字符读入,并写入另一个文件,同时显示出来(注意:在本题中,当前目录下的README.txt文件打印在屏幕上,并写入另一个文件temp.txt中)。注意:请勿改动main()主方法和其他已有的语句内容,仅在下画线处填人适当的语句。import java.io.*;public class FileCopyBy{public static void main(String args[]){try{FileReader input=new FileReader("README.txt");FileWriter utput=new FileWriter("temp.txt");int c=input.read();while(__________){__________System.out.print((char)c);c=input.read();}input.close();output.close();}catch(IOException e){System.out.println(e);}}} ” 相关考题
考题 以下程序从名为 filea.dat 的文本文件中逐个读入字符并显示在屏幕上。请填空:#include stdio.hmain(){ FILE *fp; char ch;fp=fopen( 【 15 】 );ch=fgetc(fp);whlie(!feof(fp)) { putchar(ch); ch=fgetc(fp);}putchar('\n'); fclose(fp);}

考题 阅读以下程序及对程序功能的描述,其中正确的描述是#include stdio.hmain(){FILE *in,*out;char ch,infile[10],outfile[10];printf("Enter the infile name:\n");scanf("%s",infile);printf("Enter the outfile name:\n");scanf("%s",outfile);if((in=fopen(infile,"r"))==NULL){printf("cannot open infile\n");exit(0);}if((out=fopen(outfile,"w"))==NULL){printf("cannot open outfile\n");exit(0);}while(! feof(in))fputc(fgetc(in),out);fclose(in);fclose(out);}A.程序完成将磁盘文件的信息在屏幕上显示的功能B.程序完成将两个磁盘文件合二为一的功能C.程序完成将一个磁盘文件复制到另一个磁盘文件中D.程序完成将两个磁盘文件合并并在屏幕上输出

考题 阅读以下程序及对程序功能的描述,其中正确的是#include stdio.hmain(){ FILE *in,*out;char ch,infile[10],outfile[10];printf("Enter the infile name:\n");scanf("%s",infile);printf("Enter the outfile name: \n");scanf("%s",outfile);if((in=fopen(infile,"r"))==NULL){ printf("cannot open infile\n");exit(0); }if((out=fopen(outfile,"w"))==NULL){ printf("cannot open outfile\n");exit(0); }while(! feof(in))fputc(fgetc(in),out);fclose(in);fclose(out); }A.程序完成将磁盘文件的信息在屏幕上显示的功能B.程序完成将两个磁盘文件合二为一的功能C.程序完成将一个磁盘文件复制到另一个磁盘文件中D.程序完成将两个磁盘文件合并并在屏幕上输出

考题 下列程序从名为filea.dat的文本文件中逐个读入字符并显示在屏幕上。请填空。 include mai 下列程序从名为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的文本文件中逐个读入字符并显示在屏幕上。请填空。majn(){ FILE *fp; char ch;fp=fopen(______);ch=fgetc(fp);whle(!feof(fp)) { putchar(ch); ch=f8etc(fp); }putchar('\n'); fclose(fp);}

考题 阅读以下程序以及对程序功能的描述,其中正确的描述是()。includemain(){FILE * in,*out 阅读以下程序以及对程序功能的描述,其中正确的描述是( )。 #include <stdio.h> main() { FILE * in,*out; charch,infile[10],outfile[10]; printf("Enter the infile name:\n"); scanf("%s",infile); printf("Enter the outfile name:\n"); scanf("%s",outfile); if((in=fopen(infile,"r"))==NULL) { printf("cannot open infile\n");exit(0);} if((out=fopen(outfile,"w"))==NULL) { printf("cannot open outfile\n");exit(0); } while(! feof(in)) fputc(fgetc(in),out); fclose(in); fclose(out); }A.程序完成将磁盘文件的信息在屏幕上显示的功能B.程序完成将两个磁盘文件合二为一的功能C.程序完成将一个磁盘文件复制到另一个磁盘文件中的功能D.程序完成将两个磁盘文件合并并在屏幕上输出的功能

考题 阅读以下程序及对程序功能的描述,其中正确的是includemain(){FILE*in,*out;charch,inf 阅读以下程序及对程序功能的描述,其中正确的是 #include<stdio.h> main() { FILE*in,*out; charch,infile[10],outfile[10]; printf("Enter the infile name:\n"); scanf("%s",infile); printf("Enter the outfile name:\n"); scanf("%s",outfile); if((in=foen(infileA.程序完成将磁盘文件的信息在屏幕上显示的功能B.程序完成将两个磁盘文件合二为一的功能C.程序完成将一个磁盘文件复制到另一个磁盘文件中D.程序完成将两个磁盘文件合并并在屏幕上输出

考题 阅读以下程序及对程序功能的描述,其中正确的描述是#include stdio.hmain(){ FILE *in,*out; char ch,infile[10],outfile[10]; printf("Enter the infile name:\n"); scanf("%s",infile); printf("Enter the outfile name:\n"); scanf("%s",outfile); if((in=fopen(infile,"r"))==NULL) { printf("cannot open infile\n"); exit(0); } if((out=fopen(outfile,"w"))==NULL) { printf("cannot open outfile\n"); exit(0); } while(! feof(in))fputc(fgetc(in),out); fclose(in); fclose(out);}A.程序完成将磁盘文件的信息在屏幕上显示的功能B.程序完成将两个磁盘文件合二为一的功能C.程序完成将一个磁盘文件复制到另一个磁盘文件中D.程序完成将两个磁盘文件合并后在屏幕上输出

考题 从键盘读入多行文本,并指定文件名,将输入的字符写入到中指定名称的文件中。