# Help im a noob

This is a discussion on Help im a noob within the C++ Programming forums, part of the General Programming Boards category; okay so lets say Code: int lol = 40; int i = lol + rand()%40; k so now we know ...

1. ## 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. Originally Posted by macmiller
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. Originally Posted by manasij7479
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. Originally Posted by macmiller
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. Originally Posted by manasij7479
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. 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.