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)
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?
Mainframe assembler programmer by trade. C coder when I can.
Because i want it to return a Int, can you correct it plz?
Sorry, not today.
Mainframe assembler programmer by trade. C coder when I can.
anyone?
I will give you a hint.
The very first assignment you do, you lose whatever fraction you had.
Mainframe assembler programmer by trade. C coder when I can.
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