[ create a new paste ] login | about

Link: http://codepad.org/EJfgtGZr    [ raw code | fork ]

Ryan61343 - C++, pasted on Jun 2:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
void checkHorizontal(char grid[ROWS][COLUMMS], int position, int row, bool &winner, char player, int &gameCount)
{
	int count_left = 0;
	int count_right = 0;
	for(position; position>=0; position--)
		if (grid[row][position] == player)
			count_left++;
	for(position; position<6; position++)
		if(grid[row][position]==player)
			count_right++;
	if((count_left+count_right >= 4))
		winner = true;
	if(winner ==true)
	{
		system("cls");
		displayGrid(grid);
		gameCount = 42;
		cout << "Player " << player << "'s wins!\n";
		system("pause");
	


Create a new paste based on this one


Comments: