All pastes #836185 Raw Edit

Something

public cpp v1 · immutable
#836185 ·published 2007-12-29 08:16 UTC
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;    if(col >= 0 && col < 7){    	while(board[i][col] != '.')    		i++;    	    	if(i < 7){    		board[i][col] = turn;    		return true;    	}	    else{			cout << "pick another column!" << endl;			return false;		}	}	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 && turn < 42);		if(done)		cout << "congrats player " << turn % 2 + 1 << endl;	else		cout << "tie game, good job" << endl;}int main(){	play();	system("pause");	return 0;}