I have the following code and i can get it to generate the correct amount of sets the user inputs, but i can not get it to just put 3 numbers in each set. it wil give and answer similar to 345, 2345, 1234, 224 and 2345, for a user input of 5. but i need just 3 numbers per set. Any advice would be appreciated.
Thanks Miller.
void Lottery(int x)
{
int random_integer, user_input, lowest=1, highest=10, range=(highest-lowest)+1;
cout << "How many times would you like me to simulate the lottery drawing: ";
cin >> user_input;
for (int index = 0; index < user_input; index++)
{
random_integer = lowest + int (range*rand());
(RAND_MAX +1);
cout << random_integer << endl;
}
/*cout << " Operations \n " << endl;
cout << "1. Temperature Conversion Celsius to Fahrenheit" << endl;
cout << "2. Salary Calculator" << endl;
cout << "3. Print A Hollow Square" << endl;
cout << "4. Estimate The Value Of Pi" << endl;
cout << "5. Lottery Drawing" << endl;
cout << "6. Exit Program \n\n" << endl;
cin >> program; */
return;
}
This post has been edited by NickDMax: 05 December 2010 - 10:30 PM
Reason for edit:: added code tags: [code] -- paste your code here -- [/code]

New Topic/Question
Reply




MultiQuote






|