troubleshooting Question

Add a menu system

Avatar of Sargie93
Sargie93 asked on
C++
12 Comments1 Solution369 ViewsLast Modified:
So this is my code so far (I apologize for the extensive use of | and "" :

#include <Windows.h>
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <cmath>
#include <conio.h>
using namespace std;
struct first

{
      string user;

};

 int main()

{
      system("color 0F");

      struct first A, answer, yes;

      cout << "Initiating Program..." << endl;
      Sleep (1000);
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "" << endl;
      cout << "NOW LOADING...:  ";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      Sleep (500);
      cout << "|";
      system("CLS");
      cout << "Please Verify Your Name..." << endl;
      getline(cin, A.user);

      
bool correctName=false;
while(!correctName)
{

      //Set A.user here...

      if (A.user == "Josh Sarge")
      {
            correctName=true;

            cout << "" << endl;
            cout << "Program Now Processing...Please Wait..." << endl;
            Sleep (2000);
            Sleep (1000);
            cout << "Verification Complete..." << endl;
            Sleep (2000);
            Sleep (1000);
            system ("CLS");
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 2);
            cout << "Access Granted..." << endl;
            Sleep (2000);
            Sleep (1000);
            system("CLS");
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
            cout << "Welcome Josh" << endl;
            cout << ":)" << endl;
            cout << "" << endl;
            Sleep (2000);
            Sleep (1000);
            system("pause");
            return 0;

      }
        else
        {
        cout << "" << endl;
            cout << "Program Processing. Please Wait..." << endl;
            Sleep (2000);
            Sleep (1000);
            system("CLS");
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
            cout << "Access Denied..." << endl;
            Sleep (2000);
            Sleep (1000);
            cout << "" << endl;
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
            cout << "Please Enter Your Full Name" << endl;
            cout << "" << endl;
            getline(cin, A.user);
      }

}

}

It all works so far, but I'm trying to make it so that there is a menu system once the correct name has been entered. I'm pretty sure it's got something to do with creating new functions, but I don't know how to  call them into the main. I'm VERY new with this. This isn't academic, just a project I've started.

Thank you.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros