# Calculadora em C - Dúvida

## Recommended Posts

Como faço para fazer outra opcao para reabrir novamente o menu seguido de 1 cls na MSDOS ?

```#include <stdio.h>
int main(){

printf("[1] Soma\n");
printf("[2] Subtracao\n");
printf("[3] Multiplicacao\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);

break;
case 2:

printf("Digite um numero: ");
scanf("%d", &num1);

printf("Digite outro numero: ");
scanf("%d", &num2);

break;
case 3:

printf("Digite um numero: ");
scanf("%d", &num1);

printf("Digite outro numero: ");
scanf("%d", &num2);

break;
case 4:

printf("Digite um numero: ");
scanf("%d", &num1);

printf("Digite outro numero: ");
scanf("%d", &num2);

break;
case 0:
break;
return 0;

default :
printf ("Opção invalida!\n");
}

printf("======================================\n\n");

}
```
Edited by thoga31
GeSHi
##### Share on other sites

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

Como assim ?

##### Share on other sites

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

## Create an account

Register a new account

×

• #### Revista PROGRAMAR

• Wiki
• IRC
×
• Create New...