Exemplo de menu em linguagem c#

Disponível somente no TrabalhosFeitos
  • Páginas : 11 (2586 palavras )
  • Download(s) : 0
  • Publicado : 16 de abril de 2013
Ler documento completo
Amostra do texto
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main()
{

int opcao;

begin:

opcao=0;

system ("CLS");
printf ("\xC9\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xBB\n");printf ("\xBA \tMENU DE OPCOES \xBA\n");
printf ("\xC8\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xBc\n\n");
printf ("\xC9\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xBB\n");
printf ("\xBA 1- EXERCICIO I \xBA\n");
printf ("\xBA 2- EXERCICIO II \xBA\n");
printf ("\xBA3- EXERCICIO III \xBA\n");
printf ("\xBA 4- EXERCICIO IV \xBA\n");
printf ("\xBA 5- EXERCICIO V \xBA\n");
printf ("\xBA 6- EXERCICIO VI \xBA\n");
printf ("\xBA 7- EXERCICIO VII \xBA\n");
printf ("\xBA 8- EXERCICIO VIII\xBA\n");
printf ("\xBA 9- EXERCICIO IX \xBA\n");
printf ("\xBA 10- EXERCICIO X \xBA\n");
printf ("\xBA 11- SAIR \xBA\n");
printf("\xC8\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xBC\n\n");
printf ("Digite a opcao seleccionada: ");
scanf ("%d",&opcao);

if (opcao >= 12 || opcao <= 0){
printf ("\t\n\nERRO DIGITE UMA OPCAO VALIDA! <Para voltar tecle ENTER>\n\n");
getch ();
fflush(stdin);
goto begin;}

switch (opcao)

{

case 1: {system ("cls");
printf ("\tEXERCICIO I\n");
printf ("\t\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\n\n");
printf ("Construa um programa que calcule a area de um triangulo.\n");
printf ("Lembre-se de que, para realizar esse calculo, e necessario utilizar a formula:\n");
printf ("\n\nArea = (base * altura /2).\n");
printf("\n\n\nDigite uma tecla para continuar <ENTER>...");
getch ();
fflush (stdin);

int base,altura,area,opcao;

exer1begin:

system ("cls");

base=0,altura=0,area=0;

printf ("Digite a Base do Triangulo: ");
scanf ("%i",&base);

printf ("Digite a Altura do Triangulo: ");
scanf ("%i",&altura);

system ("cls");area = (base*altura)/2;

printf ("\n\n\n\n\tA Area do Triangulo e de: %i\n\n\n\n",area);

printf ("DESEJA CONTINUAR (1 - SIM) (2 - NAO) (3 - VOLTAR AO MENU): ");
scanf ("%d",&opcao);

while (opcao==1){
goto exer1begin;}

while (opcao==3){
goto begin;}

while (opcao==2){
system ("Pause");
return 0;}

break;}



case 2: {

system ("cls");
printf ("\tEXERCICIO II\n");
printf ("\t\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\n\n");
printf ("\n\nEscreva um algoritmo que receba um numero inteiro do teclado e\n");
printf ("imprima na tela seu sucessor (numero +1) e seu antecessor (numero -1).\n\n");
printf("\n\n\nDigite uma tecla para continuar <ENTER>...");
getch ();
fflush (stdin);

int num;

exer2begin:

num=0;

system ("cls");

printf ("\n\n\nDigite um numero inteiro: ");
scanf ("%i",&num);

printf ("\n\n\n\n\tO numero digitado e %i o seu antecessor %i e o seu sucessor %i\n\n\n\n",num,num-1,num+1);

int opcao;printf ("DESEJA CONTINUAR (1 - SIM) (2 - NAO) (3 - VOLTAR AO MENU) : ");
scanf ("%d",&opcao);

while (opcao==1){
goto exer2begin;}

while (opcao==3){
goto begin;}

while (opcao==2){
system ("Pause");
return 0;
}

break;
}



case 3: {

system ("cls");
printf ("\tEXERCICIO III\n\n");
printf...
tracking img