Thread: Arrrrrggghhh

  1. #16
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >pop quiz:: how many bytes in 64 bits?
    Nice trick question, I might use it to trip up some of my friends
    The answer is 8 btw.
    64bits / 8bits = 8bytes
    but I'm sure a bunch of other people answered before I saw this post.

    >with any variable type why am I always getting 0?
    Assuming that you haven't assigned a zero value to the variable, the reason is probably because it's global and you haven't assigned it a value yet. All global variables are initialized to the zero equivalent of that type automatically.

    -Prelude
    Last edited by Prelude; 02-20-2002 at 12:38 PM.
    My best code is written with the delete key.

  2. #17
    Unregistered
    Guest
    ok thx for the help

    now i have another littlke problem

    Code:
    #include <iostream.h>
    
    int main()
    
    {
    	double mass;
    	cout<<"Enter the mass in kg: ";
    	cin>>mass;
    	cout<<"This mass would produce "<<(mass*300000000*300000000)<<" Joules of energy."<<endl;
    	cout<<"It could power "<<((mass*300000000*300000000)/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 now my problem is my output is in this form... 9e+014 and 2.5e+009 so why am i getting that so many zeros i only want 9e+14 and 2.5e+09

  3. #18
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    make them float variables

Popular pages Recent additions subscribe to a feed