Hola necesito modificar el siguiente código, para que cuando x sea > que 0 el programa sume, y cuando x sea < 0 el programa tendrá que restar.
este es el código para modificar:
#include <iostream.h> //---Permite las entradas y salidas
#include <conio.h> //---Permite implementar la funcion getche
main()
{
float x,y,s;
cout << "Digite el primer número \n" ;
cin >> x;
cout << "Digite el segundo número \n";
cin >> y;
s=x/y;
if(y==0)
{
cout << "La división entre cero no está definida\n";
}
else
{
cout << "El resultado es "<< s << " \n";
}
getche();
}
# include <iostream.h> //--- allows inputs and outputs
# include <conio.h> //--- allows you to use getch
main ()
{
float x, y, s;
cout <<"Enter the first number\n";
cin>> x;
cout <<"Enter the second number\n";
cin>> y;
s = x / y;
if (y == 0)
{
cout <<"Division by zero is not defined\n";
}
else
{
cout <<"The result is" <<s <<"\n";
}
getch();
}
Seriously, google's translate was the best once. Until they gave people the permision to edit the dictionaries. That's the point where google did it's worst mistake. Sadly...