复制文本文件,从in.dat到out.dat怎么编写程序
代码如下: #include #include void main(){ int i,j; i=0; j=0; char temp; ifstream file1_source; ofstream file1_destination; file1_source。 open("infile。dat",ios::in,0); file1_destination。open("outfile。dat",ios::out,0); while(file1_source。 get(temp)) { if(i==0 && temp!=' ') { temp-=32; file1_desti...全部
代码如下: #include #include void main(){ int i,j; i=0; j=0; char temp; ifstream file1_source; ofstream file1_destination; file1_source。
open("infile。dat",ios::in,0); file1_destination。open("outfile。dat",ios::out,0); while(file1_source。
get(temp)) { if(i==0 && temp!=' ') { temp-=32; file1_destination。put(temp); i=1; } else if(temp==' ') { file1_destination。
put(temp); j=1; } else if(temp!=' '&&j==1) { temp-=32; file1_destination。put(temp); j=0; } else file1_destination。
put(temp); }} 注意,要把 infile。dat 放到当前工程的文件夹下。收起