Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- /*
- [img]http://img843.imageshack.us/img843/8658/calculon.png[/img]
- [img]http://img197.imageshack.us/img197/1995/calculo2.bmp[/img]
- */
- int main()
- {
- using namespace std;
- int numero1;
- int numero2;
- int Accion;
- cout << "******************************************\n";
- cout << "* Bienvenidos a la calculadora The BadyX *\n";
- cout << "******************************************\n";
- printf( "Que desea hacer?\n\n1) - Sumar\n2) - Restar\n3) - Multiplicar\n4) - Divir\n");
- cin >> Accion;
- /*if(Accion < 0 || Accion > 4)
- {
- cout << "\nError al seleccionar la operacion a realizar.\n"<< endl;
- }*/
- switch(Accion)
- {
- case 1: cout << "Seleccionaste la operacion sumar" << endl; break;
- case 2: cout << "Seleccionaste la operacion restar" << endl; break;
- case 3: cout << "Seleccionaste la operacion multiplicar" << endl; break;
- case 4: cout << "Seleccionaste la operacion dividir" << endl; break;
- default: cout << "\nSe a encontrado un error\n" << endl;
- }
- cout << "Introduzca el primer numero:\n";
- cin >> numero1;
- cout << "Introduzca el segundo numero:\n";
- cin >> numero2;
- cout << "\nNumero 1:\t" << numero1;
- cout << "\nNumero 2:\t" << numero2;
- switch(Accion)
- {
- case 1: cout << "\n\t + ----\nResultado:\t" << numero1 + numero2; break;
- case 2: cout << "\n\t - ----\nResultado:\t" << numero1 - numero2; break;
- case 3: cout << "\n\t * ----\nResultado:\t" << numero1 * numero2; break;
- case 4: cout << "\n\t / ----\nResultado:\t" << numero1 / numero2; break;
- default: cout << "\nSe a encontrado un error\n"<< endl;
- }
- cout << "\n\n" << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment