0

I am creating a MAC Database for my home network which shall contain a list of names of those on the network and allow me to quickly search for people when I get a warning about a user.

I am using switch statements to go to each main section (sorry, I am new to C++ and I can't remember the name for it).

The following is what I have so far, including two switch statements which I am attempting to use but unfortunately failing at:

#include <iostream>                                         
#include <fstream>                                          
#include <windows.h>
#include <string>

using namespace std;

void View_Account()                                                                  //View All Available Accounts
{
    cout << "View Account";
}
void Modify_Account()                                                                //Modify All Available Accounts
{
    cout << "Modify Account";
}

int main()
{
    int Option;                                                                      //User Menu Selection
    int Password = -1;                                                               //User Password

    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;
    }
    return 0;
}

How would I get it to go to the View_Account part when using a switch statement?

Thank you

1
Contributor
1
Reply
2
Views
5 Years
Discussion Span
Last Post by Octet
0

I have found out what I did wrong, I placed the case in '
It should of been just

case 1:
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.