Back to top in C [closed]

1

I created a calculator in C, with menu and everything else, with switch case when choosing a function between + , - , * , / , etc. You enter two values and they are executed according to the function. How to do after finishing the arithmetic operation, does the program return to the main menu to be able to choose another operation again?

    
asked by anonymous 22.01.2016 / 13:57

2 answers

4

Place a while before or between the main code, where it expects a char ( s / n ), in the first execution already initialize a variable ( opcao ) with s , after the do the writing of something like deseja efetuar mais calculos S/N? then read with scanf() , after that it will be done opcao evaluation in while, if s makes another account otherwise ends the program.

    
22.01.2016 / 14:03
0

You can also use goto and labels: , since you are using C. Example:

inicio:
print("teste");
goto inicio;
    
22.01.2016 / 14:21