Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <algorithm>
- #include <ctime>
- using namespace std;
- void Ziehung(int* arrZahlen)
- {
- for(int i=0; i<6; ++i)
- arrZahlen[i] = rand()%(49-i);
- }
- int main()
- {
- srand(time(NULL));
- int Zufallszahlen[6];
- Ziehung(Zufallszahlen);
- vector<int> Lottokugeln;
- for (int i=0; i<49; i++){
- Lottokugeln.push_back(i);
- }
- int zahlenTipp[6];
- int anzahlRichtige = 0;
- for (int i=0; i<6; i++){
- cout << i << ". Tipp: " ;
- int z=0;
- cin >> z;
- zahlenTipp[i]=z;
- }
- vector<int> LottokugelnZiehung;
- for (int i=0; i<6; i++){
- int c = Zufallszahlen[i];
- LottokugelnZiehung.push_back(Lottokugeln.at(c));
- Lottokugeln.erase(Lottokugeln.begin()+c);
- }
- vector<int>::iterator it;
- for (int i=0; i<6; i++){
- it = find(LottokugelnZiehung.begin(), LottokugelnZiehung.end(), zahlenTipp[i]);
- if (it!=LottokugelnZiehung.end()){
- anzahlRichtige++;
- }
- }
- cout << "Gezogene Lottozahlen: " << LottokugelnZiehung.at(0);
- for(int i=1; i<6; ++i)
- cout << ", " << LottokugelnZiehung.at(i);
- cout << endl;
- cout << "Dein Tipp: " << zahlenTipp[0];
- for(int i=1; i<6; ++i)
- cout << ", " << zahlenTipp[i];
- cout << endl;
- cout << "Du hast " << anzahlRichtige << " Richtige!" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement