Guest User

Untitled

a guest
Apr 23rd, 2015
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     cout << "MAP FOR MINESPEWER!" << endl << endl << endl;
  9.  
  10.     char field[100][100] = {};
  11.     int maxX = 9;
  12.     int maxY = 9;
  13.     int maxmines = 10;
  14.    
  15.  
  16.  
  17.     while( maxmines > 0)
  18.     {
  19.         if(field[rand() % maxX + 1][rand() % maxY + 1] == '*')
  20.             {/*
  21.                 maxmines++;
  22.                 continue;*/
  23.             }
  24.         else
  25.             {
  26.                 field[rand() % maxX + 1][rand() % maxY + 1] = '*';
  27.                 maxmines--;
  28.             }
  29.     }
  30.    
  31.     for(int i = 1; i < 9; i++)
  32.     {
  33.        
  34.         for(int j = 1; j < 9; j++)
  35.         {
  36.            
  37.             cout << field[i][j] << " ";
  38.            
  39.         }
  40.        
  41.         cout << endl;
  42.        
  43.     }
  44.    
  45. }
Advertisement
Add Comment
Please, Sign In to add comment