Connect Four - Suggestions?

Do you guys have a good tactic to tackle different possible events of input? It wasn't that bad putting in 'if' statements for every single possible situation in "Tic Tac Toe". But when it comes to Connect four, it's a different case. If I have to put in 'if' statements for every possible event here, it's gonna be a nightmare of grinding code.

Example:
1
2
3
4
5
If(input == pos1 && input == pos2 && input == pos3 && input == pos4){

Player X wins

}

This is bad. If you have a better solution please post.

This is what I got so far:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <iostream>
#include <cstdlib>
using namespace std;

void AssignBoard(char MultiArray[][7]){
    for(int r=0; r<6; r++){
        for(int c=0; c<7; c++){
            MultiArray[r][c] = 'O';
        }
    }
}
void DisplayBoard(char MultiArray[][7]){
    for(int r=0; r<6; r++){
        cout << "           ";
        for(int c=0; c<7; c++){
            cout << MultiArray[r][c] << "|";
        }
        cout << endl;
    }
cout << "           " << "1 2 3 4 5 6 7\n";
}
void ErrHandling(int& value){
    if(!cin){
        cout.put('\a');
        system("cls");
        system("color 1A");
        cout << "AN ERROR OCCURED\nPossible reason:\n\n- Entering a non-integer value\n";
        exit(EXIT_FAILURE);
    }
    else if(value <= 0 || value > 7){
        system("cls");
        cout << "Please, do only enter a value between 1 and 7\n\n";
        system("pause");
        system("cls");
    }
}

main(){
char board[6][7];
unsigned short loop = 0;
int value;
    while(loop != 42){
        AssignBoard(board);
        DisplayBoard(board);
        cout << endl;
            if(loop%2 == 0){
                cout << "             " << "Player X: ";
            }
            else{
                cout << "             " << "Player Y: ";
            }
        (cin >> value).get();
        ErrHandling(value);
            if(value <= 0 || value > 7)
                continue;

loop++;
    }
}

/* AGENDA

    -   Create the board
    -   Display the board
    -   Check which players turn it is
    -   Ask for input
    -   Check if input is invalid
    -   Insert markers equal to players value
    -   Check if a player has won
    -   Check if it's a draw
*/
Well I have the same exact problem, but this is what I did goto (hehe) http://www.cplusplus.com/forum/general/105032/

look at the char checkwinner() function.(line 1 of second post) It is very inefficient, but it works. I have requested a better way in that post, but yet to get an anwser. I was actually looking for an answer when I saw your question. Hope this helps!
I got an answer if it helps you any.
Topic archived. No new replies allowed.