Thread: Help im a noob

  1. #1
    Registered User
    Join Date
    May 2012
    Posts
    3

    Help im a noob

    okay so lets say


    Code:
    int lol =  40;
    
    int i = lol + rand()%40;
    k so now we know i its going to be 40(lol) + a random number between 0 and 40

    but how could i accomplish that i could be any number between 0 and 40 o.o? help please.

  2. #2
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by macmiller View Post
    k so now we know i its going to be 40(lol) + a random number between 0 and 40

    but how could i accomplish that i could be any number between 0 and 40 o.o? help please.
    Seriously ?

  3. #3
    Registered User
    Join Date
    May 2012
    Posts
    3
    Quote Originally Posted by manasij7479 View Post
    Seriously ?
    lols, you dont get it i mean when you do rand ........ then its just 1 number between the 0 and 40 but i want it to be all numbers between 0 and 40

  4. #4
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by macmiller View Post
    lols, you dont get it i mean when you do rand ........ then its just 1 number between the 0 and 40 but i want it to be all numbers between 0 and 40
    If you want all numbers between 0 and 40, why use rand ?

  5. #5
    Registered User
    Join Date
    May 2012
    Posts
    3
    Quote Originally Posted by manasij7479 View Post
    If you want all numbers between 0 and 40, why use rand ?
    it was just to set a have something to compare with, anyway do you happen to know the correct code?

  6. #6
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    You haven't yet written clearly what your program is supposed to do.
    Until you do that, you'll not get a definite answer, only guesses.

    If you just need to list all the numbers from 1 to 40, use a loop.

  7. #7

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A noob need help
    By ticktoc09 in forum C Programming
    Replies: 5
    Last Post: 02-26-2011, 02:37 AM
  2. Noob Help......If/Else :S
    By matt.s in forum C Programming
    Replies: 8
    Last Post: 03-20-2010, 03:37 PM
  3. The noob(me) needs help again! plz...
    By shadowsora15 in forum C++ Programming
    Replies: 11
    Last Post: 06-01-2007, 04:56 PM
  4. Need help...I'm a noob
    By viciousv322 in forum C++ Programming
    Replies: 8
    Last Post: 05-24-2007, 11:52 AM