int main()
{
string line;
int choice;
string word;
menu myMenu;
fstream filestr;
filestr.open ("wordsList.txt", fstream::in | fstream::out | fstream::app);
do
{
mainMenu();
cin >> choice;
cin.ignore();
if (choice == 2)
{
editMenu();
cin >> choice;
cin.ignore();
switch (choice)
{
case 5:
cout << "\nPlease type in the word to be added\n" << endl;
myMenu.addWord();
break;
case 6:
cout << "\nPlease enter the word to be deleted\n" << endl;
cin >> word;
break;
case 7:
cout << "\nPlease enter the word you wish to search for\n" << endl;
cin >> word;
break;
case 8:
cout << "\nYou have chosen to print the words list\n\n" << endl;
myMenu.printWordList();
break;
case 9:
break;
default:
cerr << "You have entered an Invalid choice\n" << endl;
}
filestr.close();
system("pause");
return 0;
}
h file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <iostream>
usingnamespace std;
class menu
{
public:
string deleteWord();
string addWord();
string searchWords();
string printWordList();
private:
string wordList;
};
There is too much missing from this for me to make any sense of it, and what is here has numerous errors (even though some of those may be because there is stuff missing). If you still need help I would suggest posting all of the code in a compilable state.
#include <iostream>
#include <iomanip>
#include <string>
#include "menu.h"
#include <fstream>
#include "play.h"
usingnamespace std;
void playMenu()
{
cout << "\n\nPlease select your Choice" << endl; // play menu
cout << "5. Play Game " << endl;
cout << "9. Go Back" << endl;
}
void editMenu()
{
cout << "\n\nPlease Enter Your Choice Below." << endl; // edit words list menu
cout << "*******************************" << endl;
cout << "5. Add a Word" << endl;
cout << "6. Delete a Word" << endl;
cout << "7. Search for a Word" << endl;
cout << "8. Print Word List" << endl;
cout << "9. Go Back" << endl;
}
void mainMenu()
{
cout << "\n\nPlease Enter Your Choice Below." << endl; // main menu choices
cout << "*******************************" << endl;
cout << "1. Play Game" << endl;
cout << "2. Edit Words List" << endl;
cout << "3. Show Hangman Galley" << endl;
cout << "4 Quit" << endl;
}
int main()
{
string line;
int choice;
string word;
menu myMenu;
std::fstream filestr;
filestr.open ("wordsList.txt", std::fstream::in | std::fstream::out | std::fstream::app);
do
{
mainMenu();
cin >> choice;
cin.ignore();
if (choice == 2)
{
editMenu();
cin >> choice;
cin.ignore();
switch (choice)
{
case 5:
cout << "\nPlease type in the word to be added\n" << endl;
myMenu.addWord(word);
break;
case 6:
cout << "\nPlease enter the word to be deleted\n" << endl;
cin >> word;
break;
case 7:
cout << "\nPlease enter the word you wish to search for\n" << endl;
cin >> word;
break;
case 8:
cout << "\nYou have chosen to print the words list\n\n" << endl;
myMenu.printWordList();
break;
case 9:
break;
default:
cerr << "You have entered an Invalid choice\n" << endl;
}
}
elseif (choice == 3)
{
hangGallery();// won't be in the final. just holding it here because it took me a while to draw them perfectly and a i am saving them here for when i need them
break;
}
elseif (choice == 1)
{
playMenu();
cin >> choice;
cin.ignore();
switch (choice)
{
case 5:
cout << " You have chosen to set your difficulty to easy and play\n" << endl;
break;
case 6:
cout << " You have chosen to set your difficulty to hard and play\n" << endl;
break;
case 7:
cout << "show the easy words list\n" << endl;
break;
case 8:
cout << "show the hard words list\n" << endl;
break;
case 9:
break;
default:
cerr << "You have entered an Invalid choice\n" << endl;
}
}
elseif (choice == 4)
{
cout << "\nHAVE A NICE DAY\n" << endl;
}
}while (choice != 4);
system("pause");
return 0;
}