๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
โœ’๏ธ C Programming/๋ˆ„๊ตฌ๋‚˜ ์‰ฝ๊ฒŒ ์ฆ๊ธฐ๋Š” C ์–ธ์–ด ์ฝ˜์„œํŠธ_๊ฐœ์ • 3ํŒ

[๋ˆ„๊ตฌ๋‚˜ ์‰ฝ๊ฒŒ ์ฆ๊ธฐ๋Š” C ์–ธ์–ด ์ฝ˜์„œํŠธ - ๊ฐœ์ • 3ํŒ] 7์žฅ Mini Project ๋ฌธ์ œ ํ’€์ด

by A Lim Han 2023. 1. 14.

# 7์žฅ Mini Project ๋ฌธ์ œ ํ’€์ด

 

 

285p_Mini Project)

#include <stdio.h>

int main()
{
	int x, y, z;
	char A, B;
	char board[3][3] = { 'o','o','o' ,'o' ,'o' ,'o' ,'o' ,'o' ,'o' };

	z = 1;

	while (1)
	{
		printf("(x, y) ์ขŒํ‘œ: ");
		scanf_s("%d %d", &x, &y);

		if (z == 1)
		{
			board[x][y] = 'A';
			z *= -1;
		}
		else
		{
			board[x][y] = 'B';
			z *= -1;
		}

		printf("----|----|----\n");
		printf(" %c  | %c  | %c \n", board[0][0], board[0][1], board[0][2]);
		printf("----|----|----\n");
		printf(" %c  | %c  | %c \n", board[1][0], board[1][1], board[1][2]);
		printf("----|----|----\n");
		printf(" %c  | %c  | %c \n", board[2][0], board[2][1], board[2][2]);
		printf("----|----|----\n");
	}

	return 0;
}