Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- #include <set>
- using namespace std;
- void lotteryGen(int lotteryType, int numberCount) {
- set<int> lotteryNumber;
- while (lotteryNumber.size() != lotteryType)
- {
- int randtemp = rand() % numberCount + 1;
- lotteryNumber.insert(randtemp);
- }
- // sort(begin(lotteryNumber), end(lotteryNumber));
- for (auto it = lotteryNumber.begin(); it !=
- lotteryNumber.end(); ++it)
- {
- cout << ' ' << *it;
- }
- cout << "" << endl;
- }
- int main() {
- int times = 0;
- int typeLottery = 0;
- srand(time_t(nullptr));
- 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