816000992.cpp - #include <iostream>#include <fstream>#include <cstring> using namespace std struct Word char word[50 struct Unique char word[50 int

816000992.cpp - #include <iostream>#include...

This preview shows page 1 - 3 out of 6 pages.

#include <iostream> #include <fstream> #include <cstring> using namespace std; struct Word{ char word[50]; }; struct Unique{ char word[50]; int count; }; void printWord(Unique uniqueWord[],int loc){ cout<<uniqueWord[loc].word<<" "; cout<<uniqueWord[loc].count<<endl; } void printMenu(){ cout<<"\t\t\tAssignment 3 MENU"<<endl; cout<<"------------------------------------------------------------------------- ------"<<endl; cout<<"\t1. Load dictionary. "<<endl; cout<<"\t2. Load passage."<<endl; cout<<"\t3. Display current loaded passage. "<<endl; cout<<"\t4. Run spell check with statistics."<<endl; cout<<"\t5. Exit Program."<<endl; cout<<"Please choose one of the options above: "; } int readWordsDictionary(Word dictWord[],char language){ ifstream fin; int i=0; char w; if(language=='E'||language=='e') fin.open("dictionary-en.txt"); if(language=='F'||language=='f') fin.open("dictionary-fr.txt"); if(language=='S'||language=='s') fin.open("dictionary-es.txt"); if(!fin.is_open()){ cout<<"Error opening file"<<endl; return 0; } fin>>dictWord[i].word; while(!fin.eof()){ i=i+1; fin>>dictWord[i].word; } fin.close(); return i; } int readPassage(char name[],char data[]){ ifstream fin; fin.open(name); fin>>noskipws; if(!fin.is_open()) cout<<"Error in opening file"<<endl; else{
Image of page 1
int i=0; fin>>data[i]; while(!fin.eof()){ i=i+1; fin>>data[i]; } data[i]=0; fin.close(); return i; } } int readWordsPassage(Word pWords[],char name[]){ ifstream fin; int i=0; fin.open(name); fin>>pWords[i].word; while(!fin.eof()){
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 6 pages?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture