Probably easy for you guys but I'm not sure if I have this right!!
Original function
int testing (int c, float d)
{
if (d > c)
return (int) d;
else
return c;
}
What I need to do:
The function returns the decimal value resulting from dividing d by c if d > c and returns the decimal resulting from dividing c by d if c is greater or equal to d
My attempt plus the reset of the program:
#include <iostream>
using namespace std;
int testing (int a, float b);
int main()
{
int x;
float y;
cout << "Enter an integer and a decimal number"<< endl;
cin >> x >> y;
cout << testing (x, y);
system("PAUSE");
return EXIT_SUCCESS;
return 0;
}
int testing (int c, float d)
{
if (d > c)
return (float) (d/c);
else
return (float) (c/d);
}
It doesn't seem to be doing anything different I don't get any decimals printed!!