language: C++ 4.7.2 (gcc-4.7.2)
date: 192 days 4 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <ctime>
int main()
{
    std::srand(std::time(NULL));
    
    char Grid[5][5] = {'G', 'P', 'W', 'P'};
    std::random_shuffle(&Grid[0][0], &Grid[0][0] + 5*5);
 
    for(int r = 0; r < 5; ++r)
    {
        for(int c = 0; c < 5; ++c)
            std::cout << (Grid[r][c] ? Grid[r][c] : '_') << ' ';
        std::cout << '\n';
    }
}