Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- cout << "MAP FOR MINESPEWER!" << endl << endl << endl;
- char field[100][100] = {};
- int maxX = 9;
- int maxY = 9;
- int maxmines = 10;
- while( maxmines > 0)
- {
- if(field[rand() % maxX + 1][rand() % maxY + 1] == '*')
- {/*
- maxmines++;
- continue;*/
- }
- else
- {
- field[rand() % maxX + 1][rand() % maxY + 1] = '*';
- maxmines--;
- }
- }
- for(int i = 1; i < 9; i++)
- {
- for(int j = 1; j < 9; j++)
- {
- cout << field[i][j] << " ";
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment