Help on switch

Here is my current program

https://gist.github.com/anonymous/6e0dd7c29da634a41aac

if you use it, it will ask which are you want to find, after you type in the length and breath it will tell you the area and then jump back to the main menu. However I wan tht program to be ran differently. I am wonder if its possible to call the other switches with a switch.

for example when the user select area of circle, can I have another menu with that that will be brought up after the area is displayed? for example:

Please enter radius of circle:1
the area is 3.1421

What will you like to do next?
1.go back to main menu
2.find area of square
3.find area of rectangle
4.quit


this is what I mean. Each of the options have their own "sub menu".

Create a function for. Area of square say int areaOfSqaure ( ) { //code to find the area}
Make another function for Area of rectangle
int areaOfRec ( ) { //your code for area of rectangle}

call the function depending on what is to be done.
Int next;
Cout<<"for main menu press 1 \
Area of square press 2 \
Area of rectangle press 3 \
Press any other key to quit: ";
Cin>>next;
Switch (next) {
Case 1:
Return main() ;
Break;

Case 2:
areaOfSquare () ;
Break;

Case 3:
areaOfRec () ;
Break;

Default:
Return 0;
}
Last edited on
Topic archived. No new replies allowed.