Run different programs from menu

Nov 6, 2013 at 12:32pm
Hi could someone help me, i have this menu and i want the user to input the correct number for the program then it runs it. this is my code for the menu

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>

using namespace std;

int main()
{

    int choice;
    cout<< "Maths Helper";
    cout<< "\n\n**************************************\n";
    cout<< "\n\n Please choose one of the following:\n";
    cout<< "\n\n 1 - Area of a circle ";
    cout<< "\n 2 - Circumference of a circle ";
    cout<< "\n 3 - Factorial of a number ";
    cout<< "\n 4 - Hypotenuse of a triangle ";
    cout<< "\n 5 - Exit";
    cout<< "\n\n\n**************************************\n";
    cout<< "\n\n Enter you choice and press return:";
    cin>>choice;
    
    switch (choice)
{
    case 1:
    cout<< "\n\nArea of a circle ";
    break;
    case 2:
    cout<< "Circumference of a circle ";
    break;
    case 3:
    cout<< "Factorial of a number ";
    break;
    case 4:
    cout<< "Hypotenuse of a triangle ";
    break; 
    case 5:
    cout<< "Exit"; 
    break;
    default:
    cout<< "\nNot a valid choice.";
    cout<< "\nchoose again";
    cin>> choice;
    break;

}
return 0;

}
Nov 6, 2013 at 1:03pm
What is the problem then?
Nov 6, 2013 at 1:25pm
Nov 6, 2013 at 1:25pm
Do you actually want to invoke different executables for each case (which is what your thread title suggests), or you just want help with implementing the maths for each case?
Topic archived. No new replies allowed.