Skip to content

Instantly share code, notes, and snippets.

@gabrielsch
Forked from coke1337/adega do pai bala.cs
Last active March 28, 2017 21:17
Show Gist options
  • Save gabrielsch/380381194414817f8a5fef8eccf4f6dd to your computer and use it in GitHub Desktop.
Save gabrielsch/380381194414817f8a5fef8eccf4f6dd to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Bem vindo a Adega mais dificil de programar de todos os tempos! \nObs: Foi dificil mesmo!");
Console.WriteLine("Digite [T] para Tinto, [B] para Branco, [R] para Rose, ou [F] para Finalizar: ");
double cv = 0, ct = 0, cb = 0, cr = 0;
string tv;
string[] teclasPermitidas = { "T", "B", "R", "F" };
do {
tecla = Console.ReadLine().toUpper();
if (Array.IndexOf(teclasPermitidas, tecla) == -1) {
Console.WriteLine("Operação Invalida!");
Console.WriteLine("Favor Digitar [T] para Tinto, [B] para Branco, [R] para Rose, ou [F] para Finalizar!");
Console.WriteLine("Numero de Tintos ja digitados: " + ct + "\nNumero de Brancos ja digitados: " + cb + "\nNumero de Roses ja digitados: " + cr + "\nTotal de Vinhos: " + cv);
continue;
}
switch (tecla) {
case "T":
cv++; ct++;
break;
case "B":
cv++; cb++;
break;
case "R":
cv++; cr++;
break;
}
} while (tecla != "F");
Console.WriteLine("Numero de vinhos Tinto: " + ct + " \nNumero de vinhos Branco: " + cb + " \nNumero de vinhos Rose: " + cr + "\nTotal de vinhos: " + cv);
Console.WriteLine("Porcentagem de vinhos Tintos: " + ct*100/cv);
Console.WriteLine("Porcentagem de vinhos Brancos: " + cb*100/cv);
Console.WriteLine("Porcentagem de vinhos Roses: " + cr*100/cv);
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment