1. ## Arrrrrggghhh

Code:
#include <iostream.h>

int main()

{
int mass;
cout<<"Enter the mass in kg: ";
cin>>mass;
int C=300000000;
double energy=double(mass*(C*C));
cout<<"This mass would produce "<<energy<<" Joules of energy."<<endl;
cout<<"It could power "<<(energy/360000)<<" 100-watt light bulbs for an hour."<<endl;
return (0);
}
enter mass 0.01
should produce 9e+14
light 2.5e+09 light bulbs

so why the hell do i get 0?

2. why is there a 'double' in front of (mass*......?

3. thats a big number, maybe TOO big for your system?

its happened before...if you use a too big of a number it goes to the max which is like 2729398012 or something lol

4. As I recall, and int can only contain values ranging from -32000 to +32000 (or thereabouts). This statement:

int C=300000000;

is assigning a very large number to a small area.

I don't have my book on me, but to point you in the right direction... look up the various data types, and how much data they can hold.

You might looking at long int, or maybe unsigned long int.

5. Did anyone notice the fact that mass is an int?
Integer types truncate any decimal part of the number so
0.01 = 0 as an int.
You might start by using a floating point variable then use an unsigned long int to cover the large numbers.

6. taylorguitarman is god, all bow down... *bows*

lol, i didnt even notice that, i just assumed his number was too big but then again, im a big fat hairy jelatenous noob

7. Sorry, not a god; it's just easier to find errors in someone else's code.

8. **searches for a new god**

pop quiz:: how many bytes in 64 bits?

9. 512
but and the regular int (32 bit) range is -2,147,483,648 to 2,147, 483, 647 .

10. sorry, I mis-read your post Paro, The correct answere is 8 not 512. 512 is the number of bits in 64 bytes 8 is the number of bytes in 64 bits.

11. 8 but...
I think you meant how many bits in 64 bytes.

12. no i meant what i said and i fooled you all!!!

NOW WHO IS GOD!!! jk

13. If its not 512 and its not 8 what is it?

14. it is 8, i didnt say it wasnt either of them...i think its 8 anyway...

god i need a new god

**continues search for a god**

15. howbout me.....oh me me me try me