#include <iostream>
using namespace std;
void task_A() {
cout << "Task A has been performed" << endl;
}
void task_B(double par) {
cout << "Task B has been performed for parameter "
<< par << endl;
}
double task_C(double p1, int p2) {
double result=p1*p2;
cout << "Task C has been performed for parameters "
<< p1 << " and " << p2 << endl;
return(result);
}
int main() {
char choice;
do {
cout << "\n\nMAIN MENU:\n\n"
<< "a - do task A\n"
<< "b - do task B\n"
<< "c - do task C\n"
<< "X - eXit the program\n"
<< "\n--> ";
cin >> choice;
double x, y, r;
int z;
switch (choice) {
case 'a' :
case 'A' :
task_A();
break;
case 'b' :
case 'B' :
cout << "Please enter a number " << endl;
cin >> x;
task_B(x);
break;
case 'c' :
case 'C' :
cout << "Please enter two numbers " << endl;
cin >> y >> z;
r=task_C(y, z);
cout << "The answer is " << r << endl;
break;
case 'X' :
break;
default :
cout << "\aI am sorry, but I did not recognize your selection\n"
<< "Could you please choose one from the following options:\n\n" << endl;
}
} while (choice!='X');
cout << "Thank you for using this software.\n"
<< "I hope to see you again soon." << endl;
return(0);
}