#Include #Include Using Namespace Void Float Int Do

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

#include <iostream>

#include <cmath>
using namespace std;
void main()
{
float n1, n2, r;
int opc;
do
{
cout << "\nMenu\n1.Suma\n2.Resta\n3.Multiplicacion\n4.Division\n";
cout << "5.Salir\nSeleccione opcion : ";
cin >> opc;
switch (opc)
{
case 1:
cout << "Ingrese n1 : "; cin >> n1;
cout << "Ingrese n2 : "; cin >> n2;
r = n1 + n2;
cout << "Suma = " << r;
break;
case 2:
cout << "Ingrese n1 : "; cin >> n1;
cout << "Ingrese n2 : "; cin >> n2;
r = n1 - n2;
cout << "Resta = " << r;
break;
case 3:
cout << "Ingrese n1 : "; cin >> n1;
cout << "Ingrese n2 : "; cin >> n2;
r = n1 * n2;
cout << "Multiplicacion = " << r;
break;
case 4:
cout << "Ingrese n1 : "; cin >> n1;
cout << "Ingrese n2 : "; cin >> n2;
r = n1 / n2;
cout << "Division = " << r;
break;
case 5:
cout << "Eligio salir";
break;
default:
cout << "Opcion no valida";
}
} while (opc != 5);
}

system("pause");

You might also like