Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <cstdlib>
- using namespace std;
- bool trafiony[10][10];
- char plansza[10][10]=
- {
- {'.','.','.','.','.','.','.','.','.','.'},
- {'.','.','.','.','.','.','.','.','.','.'},
- {'.','.','.','.','.','.','.','.','.','.'},
- {'.','.','.','.','.','.','.','.','.','.'},
- {'.','.','.','.','.','.','.','.','.','.'},
- {'.','.','.','.','.','.','.','.','.','.'},
- {'.','.','.','.','.','.','.','.','.','.'},
- {'.','.','.','.','.','.','.','.','.','.'},
- {'.','.','.','.','.','.','.','.','.','.'},
- {'.','.','.','.','.','.','.','.','.','.'},
- };
- void wyswietlPlansze()
- {
- system ("cls");
- cout << " ";
- for (int i=1; i<=10; i++) cout << i << " ";
- cout << endl;
- for (int i=0; i<10; i++)
- {
- cout << i+1 << " ";
- if (i<9) cout << " ";
- for (int j=0; j<10; j++)
- cout << plansza[i][j] << " ";
- cout << endl;
- }
- }
- int main()
- {
- wyswietlPlansze();
- cout << endl;
- cout << " Instrukcja: \n 1. Na poczatku prosze zapoznac sie z instrukcja, poniewaz po pierwszym ruchu ona zniknie. \n 2. Aby rozstawic swoje statki musisz zamienic . na X w kodzie zrodlowym. \n 3. Aby wykonac ruch wpisz wartosc x - ruch w pionie, y - ruch w poziomie. \n" ;
- cout << endl;
- char strzal[10][10]=
- {
- {'.','.','.','.','.','.','.','.','.','.'}, // Tutaj zmieniaj . na X
- {'.','.','.','.','.','.','.','.','.','.'},
- {'.','.','.','.','.','.','.','.','.','.'},
- {'.','.','.','.','.','.','.','.','.','.'},
- {'.','.','.','.','.','.','.','.','.','.'},
- {'.','.','.','.','.','.','.','.','.','.'},
- {'.','.','.','.','.','.','.','.','.','.'},
- {'.','.','.','.','.','.','.','.','.','.'},
- {'.','.','.','.','.','.','.','.','.','.'},
- {'.','.','.','.','.','.','.','.','.','.'}
- };
- for(int i=1; i<10; i++)
- {
- for(int j=1; j<10; j++)
- {
- trafiony[i][j]=false;
- int x,y;
- cout <<"Podaj x:";
- cin >> x;
- cout <<"Podaj y:";
- cin >> y;
- trafiony[x-1][y-1]=true;
- if (strzal[x-1][y-1] == '.') plansza[x-1][y-1] = 'o';
- else plansza[x-1][y-1] = 'X';
- wyswietlPlansze();
- }}
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement