I am creating a database search and I am having a bit of issue when I want to return to my main menu.
I have attempted to use loops with no success, could anyone suggest how I can do this?
#include <iostream>
#include <fstream>
#include <windows.h>
#include <string>
using namespace std;
int Password = -1;
int Option = -1;
char Complete;
string Display;
void View_Account() //View All Available Accounts
{
system("CLS");
cout << "--Viewing All Available Resources--\n" << endl;
{
ifstream File ("Log.txt", ifstream::in);
if(File.good())
{
while (!File.eof())
{
getline (File, Display);
cout << Display << endl;
}
File.close();
}
}
cout << "\n\nComplete (Y/N): ";
}
void Modify_Account() //Modify All Available Accounts
{
cout << "Modify Account";
}
int main()
{
while (Password != 1234)
{
system("CLS");
cout << "Welcome to the MAC Database Search Facility\n" << endl; //Log In Screen
cout << "Please enter your password now: ";
cin >> Password; //User Input
}
system("CLS");
cout << "Welcome ****, please select your option\n" << endl; //Welcome Screen
cout << "1 - View All Accounts" << endl; //All Available Options
cout << "2 - Modify an Account" << endl;
cout << "3 - Delete an Account" << endl;
cout << "4 - Add an Account" << endl;
cout << "5 - Search Accounts" << endl;
cout << "6 - Exit\n" << endl;
cin >> Option;
switch (Option) //Switch Statements
{
case 1:
View_Account();
break;
case 2:
Modify_Account();
break;
}
while (Option != 6);
}
How would I get it so from lines 13 to 32 (as an example) the user types Y or N, if the user types Y it goes to main(), 41 to 75?
And when they type N it repeates the question as to if they are complete?
Thank you