Thread: Help!!!!!!!!!!!

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    2

    Exclamation Help!!!!!!!!!!!

    I have to write another program for school and this one may be alittle easier....im just so stuck right now!!! Ok, you have to write a code for a program that displays random numbers on the screen and doesnt stop generating the random numbers until it hits zero.....after it hits zero, on the next line it needs to display how many numbers there are

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Code? You must post code to get help with CODE!

  3. #3
    Registered User
    Join Date
    Apr 2010
    Posts
    2

    Code!

    Code:
    /* random numbers */
    
    #include<iostream.h>
    
    int main()
    
    {
           randomize()
    
    	int i;
    
    	i = rand(9);
    	cout << i << endl;
    
    	return(0);
    
    }

  4. #4
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    Don't title your threads "help" please.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Mainly what you're missing is a loop, a conditional, and another variable to count the numbers. Sections on each of those should be very clearly labelled in your book. Do you have any specific questions on any of them?

  6. #6
    Registered User ~Kyo~'s Avatar
    Join Date
    Jun 2004
    Posts
    320
    think of what it needs to do

    I want it to do the following
    generate an int and display to screen
    check to see if int is 0
    if int is 0 stop

    now I want it to tell me how many numbers it was untill I reached 0

    When you write code think in simple steps and write code to complete the simple steps.

Popular pages Recent additions subscribe to a feed