Hi everybody!
I dont want to lie and say this isn't an assignment because it is, and I have really got stuck here.
The assignment was to create a lottery-program which randomly displays 10 ordinary numbers and 5 extra numbers, all in between the interval of 1-50. The problem is the last task in which the numbers must not repeat itself.
I have tried using array but cant get it to work. The array must save each character and loop over again to compare them for not being displayed twice.
, I just cant do this?!
Any answer is a good and helpfull answer!
Best regards
Adam
#include <iostream> //programkod för in- och utmatning
#include <ctime>
#include <cstdlib>
using namespace std;
int main()
{
srand(time(0));
for(int ordinary=0; ordinary<10; ordinary++)
{
cout<<rand()%50+1<<endl;
}
cout<<endl<<endl;
for(int extra=0; extra<5; extra++)
{
cout<<rand()%50+1<<endl;
}
return 0;
}