3个回答
展开全部
//#include "stdafx.h"//vc++6.0加上这一行.
#include <iostream>
#include <fstream>
using namespace std;
void main(void){
ifstream infile("file1.txt",ios::in);
ofstream outfile("file2.txt",ios::out | ios::trunc);
if(!infile || !outfile){
cout << "Open file failure...\n";
exit(0);
}
double a[10];
int i=0;
char ch;
while(!infile.eof()){
infile >> a[i];
ch=infile.get();
outfile << a[i++];
outfile.put(ch);
}
}
#include <iostream>
#include <fstream>
using namespace std;
void main(void){
ifstream infile("file1.txt",ios::in);
ofstream outfile("file2.txt",ios::out | ios::trunc);
if(!infile || !outfile){
cout << "Open file failure...\n";
exit(0);
}
double a[10];
int i=0;
char ch;
while(!infile.eof()){
infile >> a[i];
ch=infile.get();
outfile << a[i++];
outfile.put(ch);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询