float decimal = 2.345324


float dec_points = decimal%1;

hey guys,
I have a small but trivial problem... i have been trying to do the above but i keep getting a error...
"error C2296: '%' : illegal, left operand has type 'float'"
Anyone got a clue?
Thanks guys!

Recommended Answers

All 2 Replies

The modulus operator (%) requires integral data types for its operands. At any rate x % 1 is zero.

commented: Thanks Dave - totally forgot about that function. +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.