View difference between Paste ID: rzuXhAye and YKn3ZV2J
SHOW: | | - or go back to the newest paste.
1
#include "spellcheck.h"
2
3
using namespace std;
4
5
bool check_spelling(char *dict, char *word)
6
{
7
	bool foundword = false;
8
	string line;
9
  	ifstream dictionary (dict);
10
  	if (dictionary.is_open())
11
  	{
12
   		while (dictionary.good())
13
    		{
14
      		getline (dictionary,line);
15
      		if(string(word) == line)
16
		{
17
			foundword = true;
18
			break;
19
		}
20
		
21
	
22
    		}
23
    		dictionary.close();
24
 	 }
25
	else
26
	{
27
	 throw 1;
28
	}
29
30
	return foundword;
31
32
}
33
34-
void add_word(char *dict1, char *word)
34+
void add_word(char *dict, char *word)
35
{
36-
	ofstream dictionary(dict1);
36+
	ofstream dictionary(dict);
37
  	if (dictionary.is_open())
38
  	{
39-
    	dictionary << word1;
39+
    	dictionary << word;
40
    	dictionary << "\n";
41
    	dictionary.close();
42
 	}
43
  	else
44
	{
45
		throw 1;
46
	}
47
  	
48
}