0
How can ı make a function with use floating point numbers(double)???? and I dont want to rounding my numbers and inputs.
as an explain, #include <iostream> using namespace std; int a(double b,double r) { if ((b/r)%2==0||((b/r)-1)%2==0) { return b/r; } else { return ((b/r)*r)- 1; } } int main() { cout << "please enter the share of number"; cin >> x cout << "please enter the denominator of number"; cin >> y cout << a(x,y); return 0; } this a function that is giving us exact value function. but it doesnt work because of rounding number. what should ı do for this??
1 Antwort
0
lot of variables you dont have declared. this code is bad