Pular para o conteúdo principal

C++, snack bar or Theater, programa!Programa calculo consumo bar!

/* Theater lobby snack bar program */

#include
#include
#include

#define TRUE 1 //This is true
#define FALSE !(TRUE) //This is not true

void main()
{
char c; //their choice
int done; //while loop ender
float total=0; //start their total at zero;

printf("Please make your treat selections:\n");
printf("B - Beverage.\n");
printf("C - Candy.\n");
printf("H - Hot dog.\n");
printf("P - Popcorn.\n");
printf("= - Done.\n");
printf("Your choice:\n");

/* Now you must figure out what they typed in. */

done=FALSE;
while(!done)
{
c=toupper(getch()); //get input
switch(c) //find the key they pressed
{
case 'B': //Beverage
printf("B - Beverage\tThat will be $2\n");
total+=2;
break;
case 'C': //Candy
printf("C - Candy\tThat will be $1.50\n");
total+=1.5;
break;
case 'H': //Hot dog
printf("H - Hot dog\tThat will be $4\n");
total+=4;
break;
case 'P': //Pop corn
printf("P - Popcorn\tThat will be $3\n");
total+=3;
break;
case '=': //done
printf("= Total of $%.2f\n",total);
printf("Please pay the cashier.\n");
done=TRUE;
} //end switch-case
} //end while
system("pause");
}

Please make your treat selections:
B - Beverage.
C - Candy.
H - Hot dog.
P - Popcorn.
= - Done.
Your choice:
B - Beverage    That will be $2
C - Candy       That will be $1.50
H - Hot dog     That will be $4
= Total of $7.50
Please pay the cashier.
Pressione qualquer tecla para continuar. . .

Comentários

Postagens mais visitadas deste blog

Excel, Banco de horas, planilha editada, modelo banco de horas em excel!!

Excel, Banco de horas, planilha editada, modelo banco de horas em excel!! Download para Banco de Horas!

EXCEL, DEMONSTRATIVO DE RESULTADOS, PLANILHA

DEMONSTRTRATIVO DE RESULTADOS .XLS Download para demonstrativo de resultados. para tomar as decisões mais importantes do seu negocio é preciso que você tenha algumas informações importantes, uma delas é rentabilidade de seu negócio, para saber isso é indispensável utilizar a DRE (Demonstração do Resultado do Exercício)

Excel, cronograma geral de execução, planilha 52 semanas, modelo, download, editável, configuração fácil

Excel, cronograma geral de execução, planilha 52 semanas, modelo, download, editável, configuração fácil  Link para download!