Thanks for that info people but I think you miss taken me,
Im after a way of checking a float if it has a decimal point in it or not
So I a can pass the input to the next stage!!!
If int as decimal or else
p.s still learning how to type tho......lol![]()
This is a discussion on ME AGAIN......heheheh within the C++ Programming forums, part of the General Programming Boards category; Thanks for that info people but I think you miss taken me, Im after a way of checking a float ...
Thanks for that info people but I think you miss taken me,
Im after a way of checking a float if it has a decimal point in it or not
So I a can pass the input to the next stage!!!
If int as decimal or else
p.s still learning how to type tho......lol![]()
Ok that is a different question than what you had posted before.
To check if a number has a decimal part.......man am I tired...
I think you will use the '%' symbol. I will get back with you on that.....right now it is bed time, and I can not think.
C++ Is Powerful
I use C++
There fore I am Powerful
Ok, you can easily test if a floating point variable has desimal numbers.
This tests if the floating point value is same as its integer conversion.Code:if (Variable == (int)Variable) // test if there is no desimals if ( !(Variable == (int)Variable) ) // test if there are desimals
Making error is human, but for messing things thoroughly it takes a computer
Read the input as a string, then use (say strchr) to look for a decimal point.
Do what you need to do, depending on whether you find one or not.