C Modulus

Reply

Join Date: Nov 2009
Posts: 18
Reputation: mitsuevo is an unknown quantity at this point 
Solved Threads: 1
mitsuevo mitsuevo is offline Offline
Newbie Poster

C Modulus

 
0
  #1
23 Days Ago
  1. float decimal = 2.345324
  2.  
  3.  
  4. 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!
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 201
Reputation: yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold 
Solved Threads: 35
yellowSnow's Avatar
yellowSnow yellowSnow is offline Offline
Posting Whiz in Training
 
0
  #2
23 Days Ago
The modulus operator (%) requires integral data types for its operands. At any rate x % 1 is zero.
Last edited by yellowSnow; 23 Days Ago at 10:34 am.
Manic twiddler of bits
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,339
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 236
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c
 
1
  #3
23 Days Ago
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC