Possible Duplicate:
for-loop to compare the two-dimensional array???Help!!
Im using a code to show these symbols (X, O, A). These symbols will appear in 9 fields randomly. For example see this figure:
My problem is: I don't know how to get the results. Because the slot machine game that I am developing is based on: If the user gets a serie of the same symbols in a row, he/her will get payed: 2*bet. If the user gets two series of the same symbols in a row, he/her will get payed: 3*bet. If the user gets three series of the same symbols in a row, he/her will get payed:4*bet. If the user gets four series of the same symbols in a row, he/her will get payed:5*bet. Five symbols in a row gives the player: 7 * bet. Full playing field gives: 10 * bet
Does anyone know how to solve this problem?
Here is my code for the symbols.
srand(time(0));
char game[3][3] = {{'O','X','A'}, {'X','A','X'}, {'A','O','O'}};
for (int i = 0; i < 3; ++i)
{
int r = rand() % 3;
cout << " " <<game[r][0] << " | " << game[r][1] << " | " << game[r][2] << "\n";
cout << "___|___|___\n";
}
......should I use a for lopp? Please help me I just begun learning c++ and I don't have any great skills yet.