Help!!!!!!!!!!!

This is a discussion on Help!!!!!!!!!!! within the C++ Programming forums, part of the General Programming Boards category; I have to write another program for school and this one may be alittle easier....im just so stuck right now!!! ...

  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
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,641
    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,231
    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
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    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
    319
    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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21