63,596
社区成员




#include<iostream>
#include<string>
#include<fstream>
#include<sstream>
using namespace std;
int main()
{
ifstream infile("raw.txt");
ofstream outf("out.txt",ios::app);
if(!infile)
{
cerr<<"no infile"<<endl;
return 1;
}
string wellname;
while(getline(infile,wellname))
{
istringstream stream(wellname);
string word;
stream>>word;
outf<<word<<" ";
cout<<word<<ends;
stream>>word;
outf<<word<<endl;
cout<<word<<endl;
}
outf.close();
infile.close();
return 0;
}
#include<iostream>
#include<string>
#include<fstream>
#include<sstream>
using namespace std;
int main(){
ifstream infile("raw.txt");
ofstream outf;
outf.open("out.txt",ios::app);
if(!infile)
{
cerr<<"no infile"<<endl;
return 1;
}
string wellname;
while(getline(infile,wellname))
{
cout<<wellname<<endl;
istringstream stream(wellname);
string word;
stream>>word;
outf<<" "<<word<<" ";
}
outf.close();
infile.close();
return 0;
}
女79
女80
请按任意键继续. . .
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream infile("raw.txt");
ofstream outf;
outf.open("out.txt",ios::app);
if (!infile)
{
cerr<<"No infile"<<endl;
return 1;
}
char buffer[128];
infile.getline(buffer, sizeof(buffer));
while (!infile.fail())
{
char* p = strchr(buffer, ' ');
if (p)
*p = 0;
cout<<buffer<<endl;
outf<<buffer;
infile.getline(buffer, sizeof(buffer));
}
infile.close();
outf.close();
return 0;
}
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream infile("raw.txt");
ofstream outf;
outf.open("out.txt", ios::out);
if (!infile)
{
cerr << "No infile" << endl;
return 1;
}
string wellname, temp;
while( getline (infile, wellname) )
{
cout << wellname <<endl;
temp = wellname.substr(0, 5);
outf << temp;
}
infile.close();
outf.close();
return 0;
}