I have begun to make a lottery and the code likes this so far
Code:
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
int myNum[7];
int drawNum[7];
for (int selectYN = 1; selectYN < 7; selectYN++)
{
cout << "Enter number " << selectYN << ": ";
cin >> myNum[selectYN];
if (myNum[selectYN] > 50)
{
do
{
cout << "You didn't enter a valid value! " << endl;
cout << "Enter number " << selectYN << ": ";
cin >> myNum[selectYN];
} while (myNum[selectYN] > 50);
}
}
cout << "Your line is: ";
for (int enteredNums = 1; enteredNums < 7; enteredNums++)
{
cout << myNum[enteredNums] << " ";
}
return 0;
}
The problem is that drawNum7 I want to call random numbers from it like:
But that's not possible to do like that because this is an array and needs two {, } after =. I thought about that I could compare myNum7 with drawNum7 with a for loop then.
Is it any way that I can say that all drawNum7 is random draw between 50 and 1?.