create trie.h and trie.cpp


👍 g++ trie.cpp spellCheck.cpp
👍 ./a.out
A

👍 cat dictionary 
a ara are area

👍 cat trie.h                            
class Trie;

👍 cat trie.cpp 
#include "trie.h"

👍 cat spellCheck.cpp 
#include <iostream>
#include <fstream>
using namespace std;

char* strupr(char *s) {
  for (char *ss = s; 
    (*ss = toupper(*ss)); ss++);
  return s;
}

int main(int argc, char* argv[]) {
  char fileName[25], s[80];
  ifstream dictionary("dictionary");
  if (dictionary.fail()) {
    cerr << "Cannot open 'dictionary'"
         << endl;
    exit(-1);
  }
  dictionary >> s;
  cout << strupr(s) << endl;
  return 0;
}

    

ch7.4 Case Study: Spell Checker p373/391 of