Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Program: calc.cc
- // Author: Yoan Pinzon
- // Date: Agosto 30, 2006
- #include <iostream>
- using namespace std;
- int main(){
- int opc, x, y;
- do{
- cout << "====== MENU CALCULADORA ======\n";
- cout << "1.- Sumar\n2.- Restar\n3.- Multiplicar\n4.- Dividir\n0.- Terminar\n";
- cout << "==============================\n";
- cout << "Ingrese su seleccion > "; cin >> opc;
- if(opc>0 && opc <=4){
- cout << "Entre 2 numeros: "; cin >> x >> y;
- switch(opc){
- case 1: cout << x << "+" << y << "=" << x+y << endl; break;
- case 2: cout << x << "-" << y << "=" << x-y << endl; break;
- case 3: cout << x << "*" << y << "=" << x*y << endl; break;
- case 4: cout << x << "/" << y << "=" << float(x)/y << endl;
- }
- }
- else if(opc!=0) cout << opc << " no es valido!, intente nuevamente." << endl;
- }while(opc!=0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement