Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8918355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:43:51+00:00 2026-06-15T05:43:51+00:00

I have this working code: /* Include files */ #include <iostream> #include <string> #include

  • 0

I have this working code:

/* Include files */
#include <iostream>
#include <string>
#include <limits>

using namespace std;

void fnMainMenu(char s);

/******************************************************************************
* Function: fnUpdateSalary
* Description: Update employee salary
******************************************************************************/
void fnUpdateSalary()
{   
    int choice = 0;
    char data = 'a';
    incorrect_input: // goto teleport exit :)
    cout<<"\n\t=======================";
    cout<<"\n\tWelcome\n";
    cout<<"\t=======================\n\n";
    cout<<"1. Update employee salary\n";
    cout<<"2. Main menu\n";
    cout<<"3. Exit system\n";
    cout<<"\n >> ";

    cin>>choice;
    cin.clear();
    cin.ignore(numeric_limits<streamsize>::max(),'\n');

    switch(choice){
        case 1 : 
            //fnUpdateSalary();
            break;
        case 2 : 
            fnMainMenu(data);
            break;
        case 3 : 
            exit(1);
            break;
        default :   
        cout<<"Input not recognized. Please enter the correct input.\n";


    }
}

void fnLog()
{   
 char data = 'b';
fnMainMenu(data); // call Main Menu and I want to pass "hello"
}





/******************************************************************************
* Function: fnMainMenu
* Description: Menu for the customer 
******************************************************************************/
void fnMainMenu(char s)
{   
     cout << s;

if (s == 'a')
{ cout << "a = admin";
}
else
{cout << "\n\nb not admin";
}

    //system("cls");
    int chooice = 0;

    cout<<"\n\t=======================";
    cout<<"\n\tWelcome\n";
    cout<<"\t=======================\n\n";
    cout<<"1. Manage employee\n";
    cout<<"2. Search employee\n";
    cout<<"3. Employee report\n";
    cout<<"4. Reset password\n";
    cout<<"5. Exit system\n";
    cout<<"\n >> ";
int numbers = 2;
    cin>>chooice;
    cin.clear();
    cin.ignore(numeric_limits<streamsize>::max(),'\n');

    switch(chooice){
        case 1 : 
            fnUpdateSalary();
            break;
        case 4 : 
        //  fnChangePassword();
            break;          
        default : exit(1);

    }
}


/******************************************************************************
* Function: main
* Description: The main calling function
******************************************************************************/
int main()
{   

    fnLog();
    return 0;
}

fnLog() send b to fnMainMenu(). When I am at fnUpdateSalary() I want to go to fnMainMenu() again. My question is, is there anyway from fnUpdateSalary() or whatever function available to call fnMainMenu() without declaring variable data again? I was hoping I could just use fnMainMenu(); instead of

char data = 'r'; fnMainMenu(data);

I get this error error C2660: 'fnMainMenu' : function does not take 0 arguments if I just called fnMainMenu();

I hope my question make sense. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:43:52+00:00Added an answer on June 15, 2026 at 5:43 am

    The parameter doesn’t seem to serve a real purpose anyway. Passing b into the main menu function certainly achieves nothing. If you just want to distinguish between admin and non-admin access, change the type and usage of the argument:

    void fnMainMenu(bool is_admin) {
        if (is_admin)
            cout << "Admin\n";
        else
            cout << "Not admin\n";
    }
    

    And call it like this:

    fnMainMenu(true);
    // Or, alternatively:
    fnMainMenu(false);
    

    That’s it. Incidentally, you don’t need (and shouldn’t!) declare a variable to pass as the argument here. Just pass the value directly, like I’ve done above.

    Also, why are your function names prefixed by fn? Don’t do this, it’s not good practice. Just use proper names that explain well what the functions do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#include <iostream> #include <fstream> #include <string> using namespace std; int main (int argc, char*
I'm trying to encrypt and decrypt files with C++, using this code: #include <iostream>
I have this working code, but now i need to be able to change
I have this (working) CPU code: #define NF 3 int ND; typedef double (*POT)(double
As a beginner in Ocaml, I have this current working code: ... let ch_in
I have this code working in C#: var request = (HttpWebRequest)WebRequest.Create(https://x.com/service); request.Method = GET;
I used to have this code working with my Tomcat server: HttpRequestBase targetRequest =
this seems to be weird but it really happened. I have this code working
I have this JQuery code working however I need to know whether how to
i have this code and its working but i want it to return dailyTotals

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.