| | |
Completing User defined function
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Jan 2008
Posts: 124
Reputation:
Solved Threads: 1
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.
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.
C++ Syntax (Toggle Plain Text)
int Func3 () { int Option; int A = 2; int B = 3; double C = 2.5; double D = 3.5; cout << " Enter your select: "; cin >> Option; }
•
•
Join Date: Nov 2007
Posts: 978
Reputation:
Solved Threads: 208
C++ Syntax (Toggle Plain Text)
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; }
![]() |
Other Threads in the C++ Forum
- Previous Thread: MessageBox with OK and CancelButton
- Next Thread: random string array
| Thread Tools | Search this Thread |
api array based binary c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





