#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
void gotoxy(int coluna, int linha){
COORD point;
point.X = coluna;
point.Y = linha;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), point);
}
int main(int argc, char *argv[])
{
inicio:
system("cls");
char resp;
char *ing[10];
char *tam[3];
int prc[10];
int pizza;
int i,j,ci,ting,ti,tf,tp;
//vector de variaveis ingredientes
ing[1]="Fiambre";
ing[2]="Bacon";
ing[3]="Cogumelos";
ing[4]="Pimentos";
ing[5]="Atum";
ing[6]="Chourico";
ing[7]="Gambas";
ing[8]="Anchovas";
ing[9]="Ananas";
ing[10]="Banana";
//vector de variaveis preço
prc[1]=2;
prc[2]=2;
prc[3]=1;
prc[4]=1;
prc[5]=1;
prc[6]=2;
prc[7]=3;
prc[8]=1;
prc[9]=1;
prc[10]=1;
//medidas do ecran 80x25
//para fazer BIP - printf("\a");
//Apresentação grafica de: Titulo, Opções de tamanho, e Ingredientes
gotoxy(3,1); printf("Pizzaria GOOD CHOICE");
gotoxy(49,1); printf("DATA : %s HORA: %s\n",__DATE__,__TIME__);
gotoxy(3,3); printf("Precos das Bases");
gotoxy(3,5); printf("1 -> Pequena: 5,00 Euros 2 -> Media: 6,00 Euros 3 -> Familiar: 7,00 Euros");
gotoxy(3,6); printf("-------------------------------------------------------------------------------");
gotoxy(3,8); printf ("Ingredientes: |");
gotoxy(2,10); printf (" 01 -> Fiambre: 2,00 Euros |");
gotoxy(2,12); printf (" 02 -> Bacon: 2,00 Euros |");
gotoxy(2,14); printf (" 03 -> Cogumelos: 1,00 Euros |");
gotoxy(2,16); printf (" 04 -> Pimentos: 1,00 Euros |");
gotoxy(2,18); printf (" 05 -> Atum: 1,00 Euros |");
gotoxy(2,20); printf (" 06 -> Chourico: 2,00 Euros |");
gotoxy(2,22); printf (" 07 -> Gambas: 3,00 Euros |");
gotoxy(2,24); printf (" 08 -> Anchovas: 1,00 Euros |");
gotoxy(2,26); printf (" 09 -> Ananas: 1,00 Euros |");
gotoxy(2,28); printf (" 10 -> Banana: 1,00 Euros |");
gotoxy(2,32); printf(" -------------------------------------------------------------------------------");
gotoxy(40,8); printf (" Escolha o Tamanho da pizza ->");
gotoxy(40,9); printf (" -----------------------------------------");
gotoxy(45,12); printf (" Escolha o numero");
gotoxy(45,13); printf (" de Ingredientes (2-4) ->");
gotoxy(45,14); printf (" ------------------------------------");
gotoxy(40,17); printf ("| Cod.Ing.| Descricao | Preco |");
gotoxy(40,18); printf ("|---------|--------------------|----------|");
gotoxy(40,19); printf ("| | | |");
gotoxy(40,20); printf ("| | | |");
gotoxy(40,21); printf ("| | | |");
gotoxy(40,22); printf ("| | | |");
gotoxy(40,23); printf ("| | | |");
gotoxy(40,24); printf ("|-----------------------------------------|");
gotoxy(40,25); printf (" | |");
gotoxy(40,26); printf (" valor total Ingredientes | |");
gotoxy(40,27); printf (" |----------|");
gotoxy(40,28); printf (" | |");
gotoxy(40,29); printf (" valor total a pagar | |");
gotoxy(40,30); printf (" | |");
gotoxy(40,31); printf (" | |");
//Escolha do tamanho de base = preço inicial
pizza:
gotoxy(72,8);scanf("%d",&pizza);
if (pizza==1) tp=5;
if (pizza==2) tp=6;
if (pizza==3) tp=7;
if ((pizza<=0) || (pizza>=4))
goto pizza;
//Escolha do nº de ingredientes
numing:
gotoxy(72,13);scanf("%d",&ting);
if ((ting<=1) || (ting>=5))
goto numing;
//Escolha dos ingredientes
ti=0;
for(i=1;i<=ting;i++)
{
repetir:
gotoxy(45,18+i);scanf("%d",&ci);
if ((ci<=0) || (ci>=11))
goto repetir;
gotoxy(52,18+i);printf("%s",ing[ci]);
gotoxy(76,18+i);printf("%d",prc[ci]);
ti=ti+prc[ci];
}
gotoxy(76,25);printf("%d",ti);
gotoxy(76,29);printf("%d",(ti+tp));
printf("\n\n\n\n\n");
printf("Prima qualquer tecla, para um novo pedido, ou T para Terminar: ");
getchar();
getchar();
scanf("%c",&resp);
if (resp!='t')goto inicio;
return 0;
}
#include <stdlib.h>
#include <windows.h>
void gotoxy(int coluna, int linha){
COORD point;
point.X = coluna;
point.Y = linha;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), point);
}
int main(int argc, char *argv[])
{
inicio:
system("cls");
char resp;
char *ing[10];
char *tam[3];
int prc[10];
int pizza;
int i,j,ci,ting,ti,tf,tp;
//vector de variaveis ingredientes
ing[1]="Fiambre";
ing[2]="Bacon";
ing[3]="Cogumelos";
ing[4]="Pimentos";
ing[5]="Atum";
ing[6]="Chourico";
ing[7]="Gambas";
ing[8]="Anchovas";
ing[9]="Ananas";
ing[10]="Banana";
//vector de variaveis preço
prc[1]=2;
prc[2]=2;
prc[3]=1;
prc[4]=1;
prc[5]=1;
prc[6]=2;
prc[7]=3;
prc[8]=1;
prc[9]=1;
prc[10]=1;
//medidas do ecran 80x25
//para fazer BIP - printf("\a");
//Apresentação grafica de: Titulo, Opções de tamanho, e Ingredientes
gotoxy(3,1); printf("Pizzaria GOOD CHOICE");
gotoxy(49,1); printf("DATA : %s HORA: %s\n",__DATE__,__TIME__);
gotoxy(3,3); printf("Precos das Bases");
gotoxy(3,5); printf("1 -> Pequena: 5,00 Euros 2 -> Media: 6,00 Euros 3 -> Familiar: 7,00 Euros");
gotoxy(3,6); printf("-------------------------------------------------------------------------------");
gotoxy(3,8); printf ("Ingredientes: |");
gotoxy(2,10); printf (" 01 -> Fiambre: 2,00 Euros |");
gotoxy(2,12); printf (" 02 -> Bacon: 2,00 Euros |");
gotoxy(2,14); printf (" 03 -> Cogumelos: 1,00 Euros |");
gotoxy(2,16); printf (" 04 -> Pimentos: 1,00 Euros |");
gotoxy(2,18); printf (" 05 -> Atum: 1,00 Euros |");
gotoxy(2,20); printf (" 06 -> Chourico: 2,00 Euros |");
gotoxy(2,22); printf (" 07 -> Gambas: 3,00 Euros |");
gotoxy(2,24); printf (" 08 -> Anchovas: 1,00 Euros |");
gotoxy(2,26); printf (" 09 -> Ananas: 1,00 Euros |");
gotoxy(2,28); printf (" 10 -> Banana: 1,00 Euros |");
gotoxy(2,32); printf(" -------------------------------------------------------------------------------");
gotoxy(40,8); printf (" Escolha o Tamanho da pizza ->");
gotoxy(40,9); printf (" -----------------------------------------");
gotoxy(45,12); printf (" Escolha o numero");
gotoxy(45,13); printf (" de Ingredientes (2-4) ->");
gotoxy(45,14); printf (" ------------------------------------");
gotoxy(40,17); printf ("| Cod.Ing.| Descricao | Preco |");
gotoxy(40,18); printf ("|---------|--------------------|----------|");
gotoxy(40,19); printf ("| | | |");
gotoxy(40,20); printf ("| | | |");
gotoxy(40,21); printf ("| | | |");
gotoxy(40,22); printf ("| | | |");
gotoxy(40,23); printf ("| | | |");
gotoxy(40,24); printf ("|-----------------------------------------|");
gotoxy(40,25); printf (" | |");
gotoxy(40,26); printf (" valor total Ingredientes | |");
gotoxy(40,27); printf (" |----------|");
gotoxy(40,28); printf (" | |");
gotoxy(40,29); printf (" valor total a pagar | |");
gotoxy(40,30); printf (" | |");
gotoxy(40,31); printf (" | |");
//Escolha do tamanho de base = preço inicial
pizza:
gotoxy(72,8);scanf("%d",&pizza);
if (pizza==1) tp=5;
if (pizza==2) tp=6;
if (pizza==3) tp=7;
if ((pizza<=0) || (pizza>=4))
goto pizza;
//Escolha do nº de ingredientes
numing:
gotoxy(72,13);scanf("%d",&ting);
if ((ting<=1) || (ting>=5))
goto numing;
//Escolha dos ingredientes
ti=0;
for(i=1;i<=ting;i++)
{
repetir:
gotoxy(45,18+i);scanf("%d",&ci);
if ((ci<=0) || (ci>=11))
goto repetir;
gotoxy(52,18+i);printf("%s",ing[ci]);
gotoxy(76,18+i);printf("%d",prc[ci]);
ti=ti+prc[ci];
}
gotoxy(76,25);printf("%d",ti);
gotoxy(76,29);printf("%d",(ti+tp));
printf("\n\n\n\n\n");
printf("Prima qualquer tecla, para um novo pedido, ou T para Terminar: ");
getchar();
getchar();
scanf("%c",&resp);
if (resp!='t')goto inicio;
return 0;
}