Skip to content

Instantly share code, notes, and snippets.

@fabriciosanchez
Created November 24, 2013 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabriciosanchez/7630742 to your computer and use it in GitHub Desktop.
Save fabriciosanchez/7630742 to your computer and use it in GitHub Desktop.
Calculadora simples (método Main)
static void Main(string[] args)
{
String Valor = "";
List<string> Valores = new List<string>();
Console.WriteLine("Olá. Seja bem vindo a esta calculadora.\n");
Console.WriteLine("Diga-nos, qual operação (+, -, *, /) deseja realizar?\n");
string Operador = Console.ReadLine();
Operador = ValidaEntradaDeOperador(Operador);
while (Valor != "p" && Valor != "P")
{
Console.WriteLine("Informe o valor a ser incorporado à operação matemática. Se quiser parar, digite 'P':\n");
Valor = Console.ReadLine();
Valores.Add(Valor);
}
MontaRespostaDaOperacaoMatematica(FazOperacaoMatematica(Valores, Convert.ToChar(Operador)).ToString());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment