rendered paste body#include <iostream.h>
#include <stdlib.h>
void initialize(char board[6][7]){
int i, j;
for(i = 0; i < 6; i++){
for(j = 0; j < 7; j++)
board[i][j] = '.';
}
}
void draw_board(char board[6][7]){
int i, j;
system("cls");
cout << " | 1 | 2 | 3 | 4 | 5 | 6 | 7 | " << endl << endl;
for(i = 5; i >= 0; i--){
cout << " | ";
for(j = 0; j < 7; j++)
cout << board[i][j] << " | ";
cout << endl;
}
}
bool detect_win(char board[6][7], int col){
return false;
}
bool check_col(char board[6][7], char turn, int col){
int i = 0;
while(board[i][col] != '.')
i++;
if(i < 7){
board[i][col] = turn;
return true;
}
else{
cout << "pick another column!" << endl;
return false;
}
}
void play(){
int turn = 0;
char board[6][7], colors[2] = {'x','y'};
bool done = false;
initialize(board);
do{
int col;
draw_board(board);
do{
cout << "Player " << (turn % 2) + 1 << ", pick a column: ";
cin >> col;
}
while(!check_col(board, colors[turn%2], col - 1));
if(detect_win(board, col))
done = true;
else
turn++;
}
while(!done);
cout << "congrats player " << turn % 2 + 1 << endl;
}
int main(){
play();
return 0;
}