Number Generator. Need Help!!!

Generate all the possible 7 digits combinations from 1 - 36.

#include <iostream>
#include <stdlib.h>
#include <time.h>

using namespace std;

int main ()
{
int RandNum;

srand (time(NULL) );
RandNum = rand() % 36 + 1;

int x = 0;
int z = 0;
cout << "Please enter the length of the number combination: ";
cin >> x;
cout << "Please enter the number of combinations needed: ";
cin >>z;

for(int y = 0; y < z; y++)
{
while ( x>0)
{
RandNum = rand() % 36 + 1;
cout << RandNum << " ";
--x;
}

cout << "*" << endl;
system("pause");
return 0;
}



*HINT*

Use code tags, use some neater formatting (indents) and tell us what you need help with like what you are trying to accomplish (in better detail) and what errors or walls have presented themselves.

From what you have there:

You define RandNum twice before you even use it.

You are missing a curly end brace (}) for your for or while loop.
I guess the simplest wud be 7 nested for loops :P. random doesnt really work cus it can give the same result.
[qutoe=shinigamimj]Generate all the possible 7 digits combinations from 1 - 36.[/quote]
Um... I don't understand what you want. Numbers from 1 to 36 only have 2 digits, not 7... That being said, how does rand() fit into this project?
maybe he wants to see the odds to win lottery :D
Topic archived. No new replies allowed.