![]() |
#2
rjsp2012-07-18 08:17
|

# include"StdAfx.h"
# include<iostream>
# include<fstream>
# include<string>
using namespace std;
int main()
{
ofstream outfile("D:\\stud1.txt",ios::out);
if(!outfile)
{
cout<<"error!!!";
exit(1);
}
char a[10],b[10];
int i;
for(i=0;i<10;i++)
{
cin>>a[i];
outfile<<a[i]<<" ";
}
ifstream infile("D:\\stud1.txt",ios::in);
if(!infile)
{
cout<<"error!!!";
exit(1);
}
for(i=0;i<10;i++)
{
infile>>b[i];
cout<<b[i]<<" ";
}
outfile.close();
infile.close();
return 0;
}
# include<iostream>
# include<fstream>
# include<string>
using namespace std;
int main()
{
ofstream outfile("D:\\stud1.txt",ios::out);
if(!outfile)
{
cout<<"error!!!";
exit(1);
}
char a[10],b[10];
int i;
for(i=0;i<10;i++)
{
cin>>a[i];
outfile<<a[i]<<" ";
}
ifstream infile("D:\\stud1.txt",ios::in);
if(!infile)
{
cout<<"error!!!";
exit(1);
}
for(i=0;i<10;i++)
{
infile>>b[i];
cout<<b[i]<<" ";
}
outfile.close();
infile.close();
return 0;
}