Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <fstream>
- using namespace std;
- /*********************
- FINAL PROJECT: Dictionary Search
- STUDENT ID: 4000058881
- NAME: Dazion Prosser
- *********************/
- int main()
- {
- const int ARRAY_SIZE = 26; //* array for amount of letters in the alphabet
- const int TEXT_SIZE = 99; //* array for amount of characters in the file
- char words[TEXT_SIZE];
- char letters[ARRAY_SIZE];
- string getWord;
- ifstream infile("dictionary.txt");
- if(infile.is_open())
- cout << "File opened sucessfully!\n\n";
- else
- cout << "Unable to open file!\n\n";
- int memor = 0;
- char *charSear = new char[memor];//*used to allocate memory of any group of letters inputted by the user
- while(letters <= words)
- {
- cout << "Enter letters: ";
- cin >> charSear[memor];
- cout << endl;
- }
- int z;
- while(infile.good())
- {
- getline(infile, getWord); //Calls the string holding the information of the file
- for(int j = 0; j < getWord.length(); j++) //Reads the length of all words in the file
- {
- for(z = 0; z < memor; z++)
- {
- if(getWord[j] == charSear[z]) // compares the amount of letters inputted with
- //...the amount of letters within the file
- cout << "List of words " << getWord << endl;
- }
- }
- }
- infile.close();
- return 0;
- }
Add Comment
Please, Sign In to add comment