This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 6th, 2013  |  syntax: C++  |  size: 0.68 KB  |  views: 27  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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 *dict, char *word)
  35. {
  36.         ofstream dictionary(dict);
  37.         if (dictionary.is_open())
  38.         {
  39.         dictionary << word;
  40.         dictionary << "\n";
  41.         dictionary.close();
  42.         }
  43.         else
  44.         {
  45.                 throw 1;
  46.         }
  47.        
  48. }
clone this paste RAW Paste Data