Created
April 5, 2012 14:51
-
-
Save alvesjnr/2311640 to your computer and use it in GitHub Desktop.
Gosh, NEVER do codes like that!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
NOTE: Partially translated from portuguese to english | |
Menu: | |
Sandwich Code Price | |
Hot Dog 100 1,20 | |
Bauru 101 1,30 | |
Bauru with egg 102 1,50 | |
Hamburger 103 1,20 | |
Cheeseburguer 104 1,30 | |
Soda 105 1,00 | |
Write a code which read the sandwich code, the quantity and print the total price | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
int qtd, n; | |
float total,cod[105]; | |
cod[5]=0; | |
qtd=0; | |
total=0; | |
n=0; | |
printf("CHOOSE SANDWICH AND QUANTITY\n"); | |
printf("_________________________________________________\n"); | |
printf("Especificacao\t|\tCodigo\t|\tPreco\t|\n"); | |
printf("Cachorro quente\t|\t100\t|\t1,20\t|\n"); | |
printf("Bauru simples\t|\t101\t|\t1,30\t|\n"); | |
printf("Bauru com ovo\t|\t102\t|\t1,50\t|\n"); | |
printf("Hamburger\t|\t103\t|\t1,20\t|\n"); | |
printf("Cheeseburguer\t|\t104\t|\t1,30\t|\n"); | |
printf("Refrigerante\t|\t105\t|\t1,00\t|\n"); | |
printf("_________________________________________________\n\n"); | |
printf("Informe o codigo: "); | |
scanf("%d",&n); | |
cod[n]=n; | |
if((cod[n]>=100) && (cod[n]<=105)) | |
{ | |
printf("\nInforme a quantidade: "); | |
scanf("%d",&qtd); | |
cod[100]=1.20; | |
cod[101]=1.30; | |
cod[102]=1.50; | |
cod[103]=1.20; | |
cod[104]=1.30; | |
cod[105]=1.00; | |
total=(cod[n]*qtd); | |
printf("\nO total do pedido e: %.2f\n", total); | |
} | |
else | |
{ | |
printf("Voce informou um codigo invalido\n"); | |
} | |
system("pause"); | |
return 0; | |
} | |
Peguei numa lisata de C/C++
Muito tosco n?
On Thu, Apr 5, 2012 at 8:01 PM, Rafael Novello < ***@***.*** > wrote:
kkkkkk...que isso?? Trabalho de faculdade??
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/2311640
##
Atenciosamente,
Antonio Ribeiro
Skype: alvesjnr
Twitter: http://twitter.com/alvesjnr
Blog: http://assemblando.wordpress.com
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
kkkkkk...que isso?? Trabalho de faculdade??