Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int X,liczba;
- int g[4], a[4], b[4], j = 0;
- cout << "Wielkosc pola:";
- cin >> X;
- for (j; j < 4; j++)
- {
- g[j] = 0;
- a[j] = 0;
- b[j] = 0;
- }
- j = 0;
- do
- {
- for (j; j < 4; j++)
- {
- cout << "Oczka gracza "<<j+1<<":";
- cin >> liczba;
- if (a[j] == 1 && b[j] == 6)
- {
- g[j] = g[j] + liczba;
- if (g[j] == X)
- {
- cout << "Koniec gry! Wygral gracz:" << j << endl;
- return 0;
- }
- else if (g[j] > X)
- {
- g[j] = g[j] - liczba;
- }
- }
- else if (a[j] == 1 && liczba==6 && b[j]==0)
- {
- b[j] = 6;
- }
- else if (liczba == 1 && a[j] == 0)
- {
- a[j] = 1;
- }
- else
- {
- a[j] = 0;
- b[j] = 0;
- }
- }
- j = 0;
- cout << "Pozycja gracza 1:" << g[0] << endl;
- cout << "Pozycja gracza 2:" << g[1] << endl;
- cout << "Pozycja gracza 3:" << g[2] << endl;
- cout << "Pozycja gracza 4:" << g[3] << endl;
- } while (g[j] != X);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement