hi. can anyone please help me with this assignment?
Write a function called divideMe which takes two integer parameters
x and y and returns a double which is the division of these numbers
(x / y). If y is zero, print the message "Divisor can not be zero!"
and return 9999999.999.
EXAMPLES:
Please enter the dividend: 99
Please enter the divisor: 44
99 divided by 44 is 2.25
Press any key to continue . . .
Please enter the dividend: 22
Please enter the divisor: 7
22 divided by 7 is 3.14286
Press any key to continue . . .
Please enter the dividend: 9
Please enter the divisor: 0
Divisor can not be zero!
Press any key to continue . . .
so far i have the coding, but it is not able to output a double rather than an integer.
#include <iostream>
#include <string>
using namespace std;
double divideMe(int x, int y)
{
double quotient = x/y;
return quotient;
}
int main()
{
int dividend, divisor;
double quotient;
cout << "Please enter the dividend: ";
cin >> dividend;
cout << "Please enter the divisor: ";
cin >> divisor;
quotient = divideMe(dividend,divisor);
cout << dividend << " divided by ";
cout << divisor << " is " << quotient << endl;
}
if anyone could give me any suggestions i'd appreciate it. thanks!! :)