fryzenn Posted September 27, 2014 Report Share Posted September 27, 2014 (edited) Como faço para fazer outra opcao para reabrir novamente o menu seguido de 1 cls na MSDOS ? #include <stdio.h> int main(){ int num1, num2, resultado, opcao; printf("\t\t\t\t CALCULADORA EM C\n\n"); printf("[1] Soma\n"); printf("[2] Subtracao\n"); printf("[3] Multiplicacao\n"); printf("[4] Adisao\n"); printf("[0] Sair do Menu\n\n"); printf("-> "); scanf("%d", &opcao); printf("\n======================================\n\n"); switch (opcao){ case 1: printf("Digite um numero: "); scanf("%d", &num1); printf("Digite outro numero: "); scanf("%d", &num2); resultado = num1 + num2; printf("Resultado - %d + %d = %d \n\n", num1, num2, resultado); break; case 2: printf("Digite um numero: "); scanf("%d", &num1); printf("Digite outro numero: "); scanf("%d", &num2); resultado = num1 - num2; printf("Resultado - %d - %d = %d \n\n", num1, num2, resultado); break; case 3: printf("Digite um numero: "); scanf("%d", &num1); printf("Digite outro numero: "); scanf("%d", &num2); resultado = num1 * num2; printf("Resultado - %d x %d = %d \n\n", num1, num2, resultado); break; case 4: printf("Digite um numero: "); scanf("%d", &num1); printf("Digite outro numero: "); scanf("%d", &num2); resultado = num1 / num2; printf("Resultado - %d : %d = %d \n\n", num1, num2, resultado); break; case 0: break; return 0; default : printf ("Opção invalida!\n"); } printf("======================================\n\n"); } Edited September 27, 2014 by thoga31 GeSHi Link to comment Share on other sites More sharing options...
KTachyon Posted September 27, 2014 Report Share Posted September 27, 2014 Usa um ciclo. “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -- Tony Hoare Link to comment Share on other sites More sharing options...
fryzenn Posted September 27, 2014 Author Report Share Posted September 27, 2014 Como assim ? Link to comment Share on other sites More sharing options...
KTachyon Posted September 28, 2014 Report Share Posted September 28, 2014 Não sabes fazer um for ou um while? “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -- Tony Hoare Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now