Consider the following two function prototypes:

void Func1(int&, int&); int Func2(double, double);


-I need help completing the following C++ user-defined function Func3
-which prompts and gets an integer for the variable Option from user.
-Func1 should be called when the value of Option is 1,
- Func2 should be called when the value Option is 2, the message "Wrong Selection. " should be displayed if the user had entered anything other than 1 or 2.

int Func3 ()
{    
     int Option;
     int   A = 2;   
     int B = 3;   
     double C = 2.5;         
     double D = 3.5;
     cout << " Enter your select: ";
     cin >> Option;

     
}

pseudo-code follows:

....
get option
while option isn't 1 or 2
display "Bad option selection, re-enter it: "
get option
end while
if option is 1
call func1 with A and B
if option is 2
call func2 with C and D

please help

int Func3 ()
{    
     int Option;
     int   A = 2;   
     int B = 3;   
     double C = 2.5;         
     double D = 3.5;
     cout << " Enter your select: ";
     cin >> Option;

     if(1 == Option)
     {
          // Call func1() here
     }
     else if(2 == Option)
     {
          // Call func2() here
     }
     else
     {
          cout << "Wrong selection ...\n";
     }

     // return some value here ...
     return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.