-
-
Save gabrielsch/380381194414817f8a5fef8eccf4f6dd to your computer and use it in GitHub Desktop.
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
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