randomise a two-dimensional array?
<p>I am developing a game where the user plays a slot machine. The slot machine needs to randomise the 3 different symbols in nine pieces fields, for example the symbols: </p>

<p>A A A 
O A O 
X X X </p>

<p>I am using a two-dimensional array but I don't know how to randomise the array?
The second problem. I don't know how to compare the symbols in the array?
The goal of the game is to obtain as many rows, columns, and diagonals as possible of the same symbol. In the above example, obtained a profit when the upper and lower line have equal symbols, partly 2x lines. Depending on the number of rows with the same symbol the user gets paid as the profit system follows:</p>

<ul>
<li>A series provides 2 * bet</li>
<li>Two lines giving 3 * bet</li>
<li>Three rows giving 4 * bet</li>
<li>Four rows gives 5 * bet</li>
<li>Five lines gives 7 * bet</li>
<li>Fully playing field gives 10 * bet</li>
</ul>

<p>I don't know how to fix this problem with the rows and money?
Can someone help me with the code?</p>

<p>This is my code for the two-dimensional array:
I don't know if Im doin the right thing so can someone please help me. I just started learning c++. I wan to randomise the symbols and compare them. </p>

<pre><code>char game[3][3] = {{'X','X','X'}, {'A','A','A'}, {'O','O','O'}};

cout &lt;&lt; game[0][0] &lt;&lt; game[0][1] &lt;&lt; game[0][2] &lt;&lt; "\n";
cout &lt;&lt; game[1][0] &lt;&lt; game[1][1] &lt;&lt; game[1][2] &lt;&lt; "\n";
cout &lt;&lt; game[2][0] &lt;&lt; game[2][1] &lt;&lt; game[2][2] &lt;&lt; "\n";


#include &lt;iostream&gt;
#include &lt;cstdlib&gt;   
#include &lt;ctime&gt;   
#include &lt;cmath&gt; 
using namespace std;  
void insertmoney();
void newgame();
void slot();
int money, moneyleft = 0;  
int bet;


int main()   
{

    int mainmenu = 1;  
    system("CLS"); 
    cout &lt;&lt; endl;
    cout &lt;&lt; "Options:\n" &lt;&lt; endl;
    cout &lt;&lt; " [1] Start New Game\n\n\n"
    &lt;&lt; " [2] Quit\n\n";  
    cin &gt;&gt; mainmenu;
    if (mainmenu &lt; 1 || mainmenu &gt; 2)   
    {
     system("CLS");
     main();   
    }
    if(mainmenu == 1)
    {
     insertmoney();
    }
    if(mainmenu == 2)
    {

     return 0; 

    }

    newgame();  
    slot();

system("pause");     
return 0;  
}

void insertmoney()   
{
     system("CLS");
     do
     {
     cout &lt;&lt; "Please insert money: 100 SEK, 300 SEK or 500 SEK\n";
     cin &gt;&gt; money;
     }while(money != 100 &amp;&amp; money != 300 &amp;&amp; money != 500);  
     cout &lt;&lt; "Insert is accepted!" &lt;&lt; endl;
     cout &lt;&lt; "Current insert is: " &lt;&lt; money &lt;&lt; endl;       
     moneyleft += money;       

system("pause");
}

void newgame()
{
     system("CLS");
     do
     {
     cout &lt;&lt; "Please place your bet: " &lt;&lt; endl;
     cout &lt;&lt; "OBS: You are not allowed to exceed the amount of insert money!" &lt;&lt; endl;
     cin &gt;&gt; bet;
     }while(bet &gt; money);   
     cout &lt;&lt; "Bet is accepted!" &lt;&lt; endl;
     cout &lt;&lt; "Current bet is: " &lt;&lt; bet &lt;&lt; endl;
     moneyleft -=bet;      

system("pause");
}

void slot()
{
    system("CLS");
    int slotmenu;
    cout &lt;&lt; endl;
    cout &lt;&lt; "[1] Play\n"
    &lt;&lt; "[2] Main Menu\n\n";
    cin &gt;&gt; slotmenu;
    if (slotmenu == 1)
    {
        system("CLS");
        cout &lt;&lt; "Your bet is: " &lt;&lt; bet &lt;&lt; endl;
        cout &lt;&lt; "The game is on!!!" &lt;&lt; endl;
        cout &lt;&lt; endl;
        bet--;

        char symbs[] = {'O','X','A'}; 
        char game[3][3];   

        for (int i = 0; i != 3 ; i++)  
        { 
            for (int j = 0; j != 3 ; j++) 
            { 
                int rndnum = round((double)rand() / (double) RAND_MAX * 3); 
                game[i][j] = symbs[rndnum]; 
            } 
        }
    } 
}
</code></pre>
