Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- #include <set>
- #include <random>
- using namespace std;
- void lotteryGen(int lotteryType, int numberCount)
- {
- random_device rd;
- mt19937 gen(rd());
- uniform_int_distribution<> dist(1, numberCount);
- set<int> lotteryNumber;
- while (lotteryNumber.size() != lotteryType)
- {
- int randtemp = dist(gen);
- lotteryNumber.insert(randtemp);
- }
- for (auto it = lotteryNumber.begin(); it !=
- lotteryNumber.end();
- ++it)
- {
- cout << ' ' << *it;
- }
- cout << "" << endl;
- }
- int main()
- {
- int times = 0;
- int typeLottery = 0;
- cout << "Adja meg hanyas lotto (5,6,7)" << endl;
- cin >> typeLottery;
- if (typeLottery != 5 && typeLottery != 6 && typeLottery != 7)
- {
- exit(3);
- }
- cout << "Adja meg hany mezot szeretne generalni:" << endl;
- cin >> times;
- for (int i = 1; i <= times; i++)
- {
- switch (typeLottery)
- {
- case 5:
- lotteryGen(5, 90);
- break;
- case 6:
- lotteryGen(6, 45);
- break;
- case 7:
- lotteryGen(7, 35);
- break;
- default:
- cout << "Adja meg ujra a kivant tipust";
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement