Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <vector>
- using namespace std;
- int main()
- {
- fstream dataFile, inFile;
- ofstream outFile;
- string checkThis, againstThis;
- vector<string> dataFileWords;
- vector<string> inFileWords;
- int checkWords = 0;
- // string newFile;
- int line = 0;
- // cout << "Enter the file name (including .txt): ";
- // cin >> newFile;
- dataFile.open("data.txt");
- // inFile.open(newFile.c_str());
- inFile.open("inFile.txt");
- outFile.open("test.txt");
- if(!dataFile)
- {
- cout << "Error. File not found." << endl;
- system("pause");
- return 1;
- }
- if(!inFile)
- {
- cout << "Error. File not found." << endl;
- system("pause");
- return 1;
- }
- // outFile << "test";
- while(!dataFile.eof())
- {
- dataFile >> dataFileWords[checkWords];
- checkWords++;
- }
- for(checkWords; checkWords > -1; checkWords--)
- {
- cout << dataFileWords[checkWords] << endl;
- }
- /*
- while(!inFile.eof())
- {
- inFile >> againstThis;
- line++;
- if(checkThis == againstThis)
- {
- cout << "Don't use " << checkThis << endl;
- cout << "Line " << line << endl;
- }
- else
- {
- cout << checkThis << " != " << againstThis << endl;
- }
- }
- */
- dataFile.close();
- inFile.close();
- outFile.close();
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement