Why is my ceilling allways getting me ZERO as result?
code: http://pastebin.com/m765144af
(Dont tell me to use C's ceilling, i'm trying to make one)
This is a discussion on quick question within the C Programming forums, part of the General Programming Boards category; Why is my ceilling allways getting me ZERO as result? code: http://pastebin.com/m765144af (Dont tell me to use C's ceilling, i'm ...
Why is my ceilling allways getting me ZERO as result?
code: http://pastebin.com/m765144af
(Dont tell me to use C's ceilling, i'm trying to make one)
Because of the way you are using ints. Why aren't you using floats or doubles?
Mac and Windows cross platform programmer. Ruby lover.
Quote of the Day
12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.
Amen brother!
Because i want it to return a Int, can you correct it plz?![]()
Sorry, not today.
Mac and Windows cross platform programmer. Ruby lover.
Quote of the Day
12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.
Amen brother!
anyone?
I will give you a hint.
The very first assignment you do, you lose whatever fraction you had.
Mac and Windows cross platform programmer. Ruby lover.
Quote of the Day
12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.
Amen brother!
Almost trivial, if you ask me.Code:int ceiling (double x) { if (x>0 && x<1) return 1; else if (x>1 && x<2) return 2; else if (>2 && x<3) return 3; //... just keep doing this for every number else return (int)x; }![]()
I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo