NZ90
Power Member
Boas pessoal tenho uma duvida :
tenho um pro em c++ que apresenta um menu, depois escolhemos as opcoes 1 2 ou 3, e cada opcao tem um processo.
A minha duvida é apos, imaginemos realizar a opcao 1 para o programa voltar a apresentar o menu, para tar sempre a repetir ate escolher a opcao 3 que e sair
ta aqui o codigo:
Cumps ..
tenho um pro em c++ que apresenta um menu, depois escolhemos as opcoes 1 2 ou 3, e cada opcao tem um processo.
A minha duvida é apos, imaginemos realizar a opcao 1 para o programa voltar a apresentar o menu, para tar sempre a repetir ate escolher a opcao 3 que e sair
ta aqui o codigo:
Código:
[SIZE=3][FONT=Times New Roman][COLOR=white]#include <iostrean>[/COLOR][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman][COLOR=white]Using namspace std;[/COLOR][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman][COLOR=white]Void main () {[/COLOR][/FONT][/SIZE]
[FONT=Times New Roman][SIZE=3][COLOR=white]Int i, op, valor , mult, quadr[/COLOR][/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3][COLOR=white]Cout <<”--------menu-------/n”;[/COLOR][/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3][COLOR=white]Cout <<”1-->Tabuada do numero/n”;[/COLOR][/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3][COLOR=white]Cout <<”2--> Quadrado do numero/n”;[/COLOR][/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3][COLOR=white]Cout <<”0-->Sair/n”;[/COLOR][/SIZE][/FONT]
[SIZE=3][FONT=Times New Roman][COLOR=white]cout <<”---------------------------/n”;[/COLOR][/FONT][/SIZE]
[FONT=Times New Roman][SIZE=3][COLOR=white]Cin >>op;[/COLOR][/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3][COLOR=white]Switch(op) {[/COLOR][/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3][COLOR=white]Case 1: [/COLOR][/SIZE][/FONT]
[SIZE=3][FONT=Times New Roman][COLOR=white] Cout <<”Valor a calcular -->/n”[/COLOR][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman][COLOR=white] Cin >> valor;[/COLOR][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman][COLOR=white] Cout <<”/t A tabuada dos “>>valor>>”/n”;[/COLOR][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman][COLOR=white] For(i=1;i<11;i++){[/COLOR][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman][COLOR=white] mult=valor *i;[/COLOR][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman][COLOR=white]Cout >>valor>>”*”>>”=”>>mult>>”/n”;[/COLOR][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman][COLOR=white]}[/COLOR][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman][COLOR=white]Break;[/COLOR][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman][COLOR=white]Case 2: [/COLOR][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman][COLOR=white] Cout <<”valor a calcular -->/n”;[/COLOR][/FONT][/SIZE]
[FONT=Times New Roman][SIZE=3][COLOR=white]Cin>>valor; [/COLOR][/SIZE][/FONT]
[SIZE=3][FONT=Times New Roman][COLOR=white] Cout<<”/t Quadrado do “>>valor>> “/n”; [/COLOR][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman][COLOR=white]quadr = valor * valor;[/COLOR][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman][COLOR=white] cout>>valor>>”*”>>valor”=”>>quadr>>”/n”;[/COLOR][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman][COLOR=white] break;[/COLOR][/FONT][/SIZE]
Case 0:
break;
[FONT=Times New Roman][SIZE=3][COLOR=white]}[/COLOR][/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3][COLOR=white]}[/COLOR][/SIZE][/FONT]
Cumps ..