Write lottery program using array!!!

Write a lottery program that generate 5 random numbers from 1-20 inclusive.
I had the whole things but it still giving me error. I am stuck.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <iomanip>

using namespace std;

int main()
{
	srand(time(NULL));

	int lottery[5] = { 0, 0, 0, 0, 0 }, count = 0, rand_lottery;
	bool isdup = false;

	cout << "Your Lottery:" << endl;

	while (count < 5)
	{
		int rand_lottery, i;
		rand_lottery = rand()%20 +1;
		i =  lottery[5]
		for (int i = 0; i < 5; i++);
		{
				if (lottery[i] == rand_lottery)
				{
					isdup = true;
				}
		}
		if (isdup == false)
		{ 
			lottery[count] = rand_lottery;
			count++;
		}
	}
	for (int i = 0; i < 5; i++)
	{
		cout << lottery[i] << " ";

		return (0);

	}
}

Last edited on
Registered users can post here. Sign in or register to post.