All pastes #245177 Raw Edit

Stuff

public text v1 · immutable
#245177 ·published 2006-11-10 18:07 UTC
rendered paste body
#include<iostream>
using namespace std;

int main()
{	float a, b;
	char oper;

	cout << "Operandos: ";
	cin >> a >> b; 
	
	do
	{	cout << "Operacion ( +, -, *, / ): ";
		cin >> oper;
		if(oper!='+' && oper!='-' && oper!='*' && oper !='/')
			cout << "Operacion Incorrecta\n";
	}while(oper!='+' && oper!='-' && oper!='*' && oper !='/');
	
	if( oper == '/' )
		for( ; !b; )
		{	cout << "No es posible la division entre 0\n";
			cout << "Operando: ";
			cin >> b;
		}

	cout << a << " " << oper << " " << b << " = ";
	switch( oper )
	{	case '+': cout << a + b << "\n";
				  break;
		case '-': cout << a - b << "\n";
				  break;
		case '*': cout << a * b << "\n";
				  break;
		case '/': cout << a / b << "\n";
	}
	
	cin.ignore();
	cin.get();
	return 0;
}