Your misison, should you choose to accept it, is to build the following.
-When the program starts, it'll ask the user to enter either a 1, 2, or a 3.
-Based on this input, one of 3 functions should execute, then the program exits.
#include <iostream.h>
void func1(void);
void func2(void);
void func3(void);
void main(void)
{
int input;
cout << "Enter 1, 2, or 3: ";
cin >> input;
//At this point your code will call one of the 3 functions.
return;
}
void func1(void)
{
cout << "\nFunction 1 Executed\n";
}
void func2(void)
{
cout << "\nFunction 2 Executed\n";
}
void func3(void)
{
cout << "\nFunction 3 Executed\n";
}
Sounds simple right? Now here's the catch, you aren't allowed to use any conditional statements, ie if, switch, ect. No condition of any varible or memory address can ever be checked. No inline assembly. No additional headers. No external code. No return values for any function. No parameters for any function.
Question
evo0o
Your misison, should you choose to accept it, is to build the following.
-When the program starts, it'll ask the user to enter either a 1, 2, or a 3.
-Based on this input, one of 3 functions should execute, then the program exits.
#include <iostream.h> void func1(void); void func2(void); void func3(void); void main(void) { int input; cout << "Enter 1, 2, or 3: "; cin >> input; //At this point your code will call one of the 3 functions. return; } void func1(void) { cout << "\nFunction 1 Executed\n"; } void func2(void) { cout << "\nFunction 2 Executed\n"; } void func3(void) { cout << "\nFunction 3 Executed\n"; }Sounds simple right? Now here's the catch, you aren't allowed to use any conditional statements, ie if, switch, ect. No condition of any varible or memory address can ever be checked. No inline assembly. No additional headers. No external code. No return values for any function. No parameters for any function.
Link to comment
Share on other sites
2 answers to this question
Recommended Posts