# Thread: Shorten Statements are WRONG?!

1. ## Shorten Statements are WRONG?!

Ok i had a program for computer science. You take in a persons weight, a planet letter, and convert to how much they would weigh on that planet. the conversion everyone else used, say for jupiter, looked like this:

weight = weight * 0.88;

Which she gave 100's for (my teacher) i got ten points off for each time i did mine like this:

weight *= 0.88;

WTF?! I thought that was BETTER and more effecient, why would she give me points off?! And yea she went over this, but never said don't use it WTH?!

2. >> why would she give me points off?!

'cos she's dumb!

3. Well actually, Jupiter's gravity is approx. 10 - 12 times that of Earth, at it's [approximate] surface.

Therefore, to get your weight on Jupiter you should write:

weight = wieght * 10;

or if you like

weight *= 10;

5. she made up the #'s davros :P

I did, she told me it was a bad practice.....i'm not c++ god in any respect, but i have to disagree.

6. >she made up the #'s davros :P

Oop. Sorry for being a smart-ass. I'm just bored.

May be that's also why you lost ten points.

7. disassemble "weight = weight * .88;" and "weight *= .88;" and show them to her!

8. Tell her to learn c++ herself!
A good starting point for her as she obviously knows the syntax but not the use of c++ would be scott meyers effective series.

Point her to More effective c++ item number 22 : Consider using op= rather than op.

You may quote me. Yes, tell her to learn C++, or perhaps start with C first.

10. And from what i've seen, I HIGHLY doubt your teacher knows anything close to what Stoned_Coder, Sang-drax or Davros does.

Style is... well just that, style. I can't see any competent teacher taking off points for something which gets the job done just as efficiently, and is as (if not more) readable.

if (!strcmp(string1, string2)) is not "preferred"
if (strcmp(string1, string2) == 0) is, but it really doesn't matter.

11. I bet she includes <iostream.h>

12. yea well the iostream header file is kinda needed there dude :P

13. int main?? Why are you returning an int from main? It only wastes time.

Seriously though, as for your teacher, POLITELY ask her to get a second opinion. If she refuses to, go to the next person in the chain of command at your school.

14. I may ask to talk to her after class about it, i don't want her feeling that i am challenging her with the students to see...

as for main, my preference is

int main()
{
......
return 0;
}

15. If this is a C++ class, not just a general programming class, that's scary ...