Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int const size = 10;
- int arr[size][size];
- int oneCount = 0;
- for(int i = 0; i < size; i++)
- {
- for(int j = 0; j < size; j++)
- {
- arr[i][j] = 0;
- }
- }
- for(int i = 0; i < 4; i++)
- {
- int x = rand()%10;
- int y = rand()%10;
- if (arr[x][y] == 0)
- arr[x][y] = 1;
- else
- i--;
- }
- for(int i = 0; i < size; i++)
- {
- for(int j = 0; j < size; j++)
- cout << arr[i][j] << " " ;
- }
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement