Current location - Recipe Complete Network - Complete cookbook of home-style dishes - Write a menu program, enter 1~5 to enter the corresponding choice, assuming that the corresponding choice is 1 addition 2 subtraction 3 multiplication 4 division 5 exit.
Write a menu program, enter 1~5 to enter the corresponding choice, assuming that the corresponding choice is 1 addition 2 subtraction 3 multiplication 4 division 5 exit.
Debugging passed! I wonder if I can meet your needs?

The functions of the four operations are not given! I think it's very simple. It should be finished!

Do it yourself, and you will gain a lot! ! !

# include & ltstdio.h & gt

# include & ltiostream.h & gt

# include & ltwindows.h & gt

void main()

{

char c;

while( 1)

{

printf(" 1 . add \ n ");

printf(" 2n ");

printf(" 3 . mul \ n ");

printf(" 4 . div \ n ");

printf(" select:");

CIN & gt; & gtc;

Switch (c)

{

Case "1":

printf(" 1 . add \ n ");

//add();

Break;

Case "2":

printf(" 2n ");

//sub();

Break;

Case "3":

printf(" 3 . mul \ n ");

//mul();

Break;

Case "4":

printf(" 4 . div \ n ");

//div();

Break;

Case "5":

printf(" 5 . exit \ n ");

Exit (0);

Break;

Default value:

Printf ("Input error! \ n ");

Break;

}

}

}