Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- int main()
- {
- string arr [5];
- string nArr [5];
- ifstream infile;
- infile.open("dictionary.txt");
- if(!infile)
- {
- cout << "Unable to open file.";
- }
- else if(infile)
- {
- while(!infile.eof())
- {
- int i = 0;
- string line;
- infile >> arr[i];
- i++;
- }
- }
- string fname;
- cout << "Welcome to Nick's Spell Checker!" << endl;
- cout << "********************************" << endl;
- cout << "Enter the name of the file that contains words to check." << endl;
- cin >> fname;
- ifstream checkfile;
- checkfile.open("wrong.txt");
- if(!checkfile)
- {
- cout << "Unable to open '" << fname << "'." << endl;
- }
- else if (checkfile)
- {
- while(!checkfile.eof())
- {
- int f = 0;
- string nLine;
- checkfile >> nArr[f];
- f++;
- }
- }
- int x = 0;
- while (x < 5)
- {
- if(arr[x] != nArr[x])
- {
- cout << endl << nArr[x] << " is spelled wrong." << endl;
- }
- x++;
- }
- cout << endl << endl << "Thank you for using Nick's spell checker." << endl << endl << endl << endl << endls;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement