Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL,"swedish");
- int choice = 0, // Valet som spelaren kommer få.
- fortune[8] = {1,1,1,1,1,1,1,1}, //"Kak"-arrayen
- saved[8] = {}, //En array som sparar i vilken ordning allting kom.
- wrong[8] = {}; // En array som sparar hur många gånger en kaka som redan ätits har valts.
- while(fortune[0,1,2,3,4,5,6,7] != 0)
- {
- for(int i = 0; i < 8; i++)
- {
- cout << "Vilken kaka vill du äta? ";
- cin >> choice; // Eftersom att val och array ska stämma får man göra choice-1
- if(fortune[choice-1] == 0)
- {
- wrong[choice-1]++;
- cout << "Tyvärr är kakan uppäten, du har redan valt den "<< wrong[choice-1] <<" ggr."<< endl;
- }
- if(fortune[choice-1] == 1)
- {
- if(choice == 1)
- {
- cout << "Det blir inte alltid som man vill." << endl;
- fortune[0] = 0;
- saved[choice-1] = choice;
- }
- if(choice == 2)
- {
- cout << "Imorgon blir det fint väder." << endl;
- fortune[1] = 0;
- saved[choice-1] = choice;
- }
- if(choice == 3)
- {
- cout << "Kasta inte glas i stenhus." << endl;
- fortune[2] = 0;
- saved[choice-1] = choice;
- }
- if(choice == 4)
- {
- cout << "Ät inte den gula snön." << endl;
- fortune[3] = 0;
- saved[choice-1] = choice;
- }
- if(choice == 5)
- {
- cout << "Din bror är din pappas son." << endl;
- fortune[4] = 0;
- saved[choice-1] = choice;
- }
- if(choice == 6)
- {
- cout << "Efter solsken kommer regn." << endl;
- fortune[5] = 0;
- saved[choice-1] = choice;
- }
- if(choice == 7)
- {
- cout << "Gå inte över ån efter vatten." << endl;
- fortune[6] = 0;
- saved[choice-1] = choice;
- }
- if(choice == 8)
- {
- cout << "Skjut inte björnen förrän skinnet är sålt." << endl;
- fortune[7] = 0;
- saved[choice-1] = choice;
- }
- }
- }
- }
- system("CLS");
- cout << "Du fick fraserna i följande ordning:" << endl;
- for(int i = 0; i < 8; i++)
- {
- if(saved[i] == 1)
- {
- cout << "Det blir inte alltid som man vill." << endl;
- }
- if(saved[i] == 2)
- {
- cout << "Imorgon blir det fint väder." << endl;
- }
- if(saved[i] == 3)
- {
- cout << "Kasta inte glas i stenhus." << endl;
- }
- if(saved[i] == 4)
- {
- cout << "Ät inte den gula snön." << endl;
- }
- if(saved[i] == 5)
- {
- cout << "Din bror är din pappas son." << endl;
- }
- if(saved[i] == 6)
- {
- cout << "Efter solsken kommer regn." << endl;
- }
- if(saved[i] == 7)
- {
- cout << "Gå inte över ån efter vatten." << endl;
- }
- if(saved[i] == 8)
- {
- cout << "Skjut inte björnen förrän skinnet är sålt." << endl;
- }
- }
- cout << endl;
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment