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??

29th Sep 2016, 7:16 PM
Şeref tahmaz
Şeref tahmaz - avatar
1 Odpowiedź
0
lot of variables you dont have declared. this code is bad
4th Nov 2016, 10:02 PM
P3RS0N
P3RS0N - avatar