Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<stdlib.h>
- using namespace std;
- int main() {
- char mapa[10][10];
- for(int i=0; i<10; i++) { //tworzenie mapy
- for(int j=0; j<10; j++) {
- mapa[i][j]='_';
- }
- }
- int generator = 0;
- for(int i=0; i<10; i++) {
- for(int j=0; j<10; j++) {
- generator=rand()%5;
- if(generator<4) {
- mapa[i][j]='_';
- }
- if(generator==4) {
- mapa[i][j]='X';
- }
- }
- }
- int licznik=0;
- for(int i=0; i<10; i++) {
- for(int j=0; j<10; j++) {
- cout<<mapa[i][j]<<" ";
- }
- licznik++;
- if(licznik=10) {
- cout<<endl;
- licznik=0;
- }
- }
- }
Add Comment
Please, Sign In to add comment