1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream inData;
inData.open("TextFile1.txt");
string j;
string p;
string c;
string h;
cin >> inputfile;
inData.open("TextFile.txt");
inData.get(j);
inData >> j >> p >> c >> h;
inData.ignore(200,',');
inData.get(p);
inData.ignore(200,',');
inData.get(c);
inData.ignore(200,',');
inData.get(h);
inData.ignore(200,',');
cout << " The first three words we found are...\n";
cout << j << p << c << h << endl;
/*cin.ignore(200,',');
cout << p;
cin.ignore(200,',');
cout << c;
cin.ignore(200,',');
cout << h;*/
inData.close();
system ("pause");
return 0;
}
|