Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » General Discussions » General Discussion » I Learn Some Basic C++!
Re: I Learn Some Basic C++! [message #392533 is a reply to message #391886] Sat, 27 June 2009 09:50 Go to previous messageGo to previous message
futura83
Messages: 1285
Registered: July 2006
Location: England
Karma:
General (1 Star)
Viva la Resistance!
Or be lazy and disregard the BODMAS rules altogether and do the calculations you want in the order you do them.



As in, assign another variable, and do the calculation in stages.


Instead of 100 * (a + b + c)....etc, add:

double f;
f = a + b + c;
f *= 100;





That way your calculations are done in the order you write them, without having an understanding of BODMAS.


P.S. This is from an A-level maths student who has no trouble with BODMAS as well. Razz



Edit: If you really don't like brackets in your example, simply do:

100 * a + 100 * b....etc....


This is a signature. Reading this is wasting your time.

[Updated on: Sat, 27 June 2009 09:51]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Your daily commute to work!
Next Topic: Virus
Goto Forum:
  


Current Time: Mon Nov 25 06:25:04 MST 2024

Total time taken to generate the page: 0.01340 seconds