Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "spellcheck.h"
- using namespace std;
- bool check_spelling(char *dict, char *word)
- {
- bool foundword = false;
- string line;
- ifstream dictionary (dict);
- if (dictionary.is_open())
- {
- while (dictionary.good())
- {
- getline (dictionary,line);
- if(string(word) == line)
- {
- foundword = true;
- break;
- }
- }
- dictionary.close();
- }
- else
- {
- throw 1;
- }
- return foundword;
- }
- void add_word(char *dict, char *word)
- {
- ofstream dictionary(dict);
- if (dictionary.is_open())
- {
- dictionary << word;
- dictionary << "\n";
- dictionary.close();
- }
- else
- {
- throw 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement