I just starting writing codes and I'm having a problem getting results from functions. I have this function here I wish to return 3*(x/y);(which is 3*(8.2/3) respectively) but the code keeps returning 0 to me. Can someone explain how I can get it to show me the correct answer, I think I have to use cout but I'm unsure how to make it get the result from my function. Thank you.
1 2 3 4 5 6 7 8 9 10 11
#include <iostream>
usingnamespace std;
#include <cmath>
int fee(double x, int y) {
return 3*(x/y);
}
int main(){
fee(8.2,3);
return 0;
}
Thank you I understand now. Is it normal for the answer to be 8 instead of 8.2? I thought because it was a double it would maintain the decimal points in my answer.