Skip to content

Instantly share code, notes, and snippets.

@flaviorl-net
Created February 24, 2022 22:41
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 flaviorl-net/d7ab3614d6ec560766100d3f063f7a82 to your computer and use it in GitHub Desktop.
Save flaviorl-net/d7ab3614d6ec560766100d3f063f7a82 to your computer and use it in GitHub Desktop.
class Program
{
static void Main(string[] args)
{
Console.Write("Escolha a operação: (sum, sub, mult, div): ");
string operacao = Console.ReadLine();
Console.Write("Digite o primeiro número: ");
int.TryParse(Console.ReadLine(), out int numero1);
Console.Write("Digite o segundo número: ");
int.TryParse(Console.ReadLine(), out int numero2);
var calculadoraStrategy = new CalculadoraStrategy(operacao);
int resultado = calculadoraStrategy.Calcular(numero1, numero2);
Console.WriteLine("Resultado: {0}", resultado);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment