Guest User

Untitled

a guest
Apr 26th, 2019
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <fstream>
  4. using namespace std;
  5. /*********************
  6.  FINAL PROJECT: Dictionary Search
  7.  STUDENT ID: 4000058881
  8.  NAME: Dazion Prosser
  9. *********************/
  10.  
  11. int main()
  12. {
  13.  
  14.     const int ARRAY_SIZE = 26; //* array for amount of letters in the alphabet
  15.     const int TEXT_SIZE = 99;  //* array for amount of characters in the file
  16.  
  17.     char words[TEXT_SIZE];
  18.     char letters[ARRAY_SIZE];
  19.  
  20.  
  21.  
  22.     string getWord;
  23.     ifstream infile("dictionary.txt");
  24.  
  25.  
  26.  
  27.     if(infile.is_open())
  28.           cout << "File opened sucessfully!\n\n";
  29.     else
  30.          cout << "Unable to open file!\n\n";
  31.  
  32.        int memor = 0;
  33.        char *charSear = new char[memor];//*used to allocate memory of any group of letters inputted by the user
  34.  
  35.  
  36.     while(letters <= words)
  37.     {
  38.  
  39.          cout << "Enter letters: ";
  40.          cin >> charSear[memor];
  41.          cout << endl;
  42.     }
  43.  
  44.  
  45.     int z;
  46.     while(infile.good())
  47.     {
  48.     getline(infile, getWord); //Calls the string holding the information of the file
  49.         for(int j = 0; j < getWord.length(); j++) //Reads the length of all words in the file
  50.          {
  51.         for(z = 0; z < memor; z++)
  52.               {
  53.         if(getWord[j] == charSear[z]) // compares the amount of letters inputted with
  54.                                                     //...the amount of letters within the file
  55.             cout << "List of words " << getWord << endl;
  56.               }
  57.          }
  58.  
  59.     }
  60.    infile.close();
  61.  
  62. return 0;
  63. }
Add Comment
Please, Sign In to add comment