Guest User

Untitled

a guest
Dec 11th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include<iostream>
  2. #include<stdlib.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. char mapa[10][10];
  7. for(int i=0; i<10; i++) { //tworzenie mapy
  8. for(int j=0; j<10; j++) {
  9. mapa[i][j]='_';
  10. }
  11. }
  12. int generator = 0;
  13. for(int i=0; i<10; i++) {
  14. for(int j=0; j<10; j++) {
  15. generator=rand()%5;
  16. if(generator<4) {
  17. mapa[i][j]='_';
  18. }
  19. if(generator==4) {
  20. mapa[i][j]='X';
  21. }
  22. }
  23. }
  24. int licznik=0;
  25. for(int i=0; i<10; i++) {
  26. for(int j=0; j<10; j++) {
  27. cout<<mapa[i][j]<<" ";
  28.  
  29.  
  30. }
  31. licznik++;
  32. if(licznik=10) {
  33. cout<<endl;
  34. licznik=0;
  35. }
  36. }
  37. }
Add Comment
Please, Sign In to add comment