Language: C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <windows.h>

#define INPUT_FILE_NAME "InputData.txt"
#define MAX_BUF 255
#define BY_STDIN 1
#define BY_FILE 0
#define TRUE 1
#define FALSE 0
#define QUEEN_NUM 8

typedef struct BoardStatus
{
	/* ????????????????????????????????????????????¢?????¶????????¨????????? */

	/* ???????????????????????????????????´????????¨?????????(index????????????, ????????????????????¨???) */
	int queenPosition[QUEEN_NUM];

	/* ?????????????????????????????????????????¨???????????° */
	/* 1 : ???????????????????????????	0 : ???????????????????????? */
	/* ???????????\?????§???????????????????????????????????????????????????(index????????????) */
	int advanceFlag[QUEEN_NUM];
	/* ???????????????????????????????????????????????????(index????????????) */
	int verticalFlag[QUEEN_NUM];
	/* ??????????????????????????????????????????????????????????????????????????????*/
	/* index???(0, 0)????????????????????????0???(0, 1), (1, 0)???????????????1...??¨???????????????????????????????????? */
	int rightUpwardFlag[(QUEEN_NUM * 2) - 1];
	/* ??????????????????????????????????????????????????????????????????????????????*/
	/* index???(0, 7)????????????????????????0???(0, 6), (1, 7)???????????????1...??¨?????????????????????????????????????????? */
	int rightDownwardFlag[(QUEEN_NUM * 2) - 1];

}BoardStatus;

typedef struct Input
{
	FILE* inputFile;		/* ???????????????????????? */
} Input;

/* ??\?????¢??° */
/* ?????°	  : in    inputType    ??\????????? ( BY_FILE : ??????????????????, BY_STDIN : ?¨??????\????????? ) */
/*          out   boardStatus     ????????????????????????????????????????????¢?????¶????????¨???????????????????§??????? */
/* ????????? :  0  ??£???, /*
/*		     1  ??¨?????? */
/* ??????   : ?????°??§???????????????????????§??\????????????????????? */
/*			??\??????????????´???????????????????????????*/
BOOL presetQueen(int inputType, BoardStatus *boardStatus);

/* ??????????§£?????¢??° */
/* ?????°   : in     n             ????????????????????????????????? */
/*          in-out boardStatus     ????????????????????????????????????????????¢?????¶????????¨???????????????????§??????? */
/* ????????? : TRUE   8?????????????????????????????? */
/*		    FALSE  ?????????????????????????????????????????? */
/* ??????   : ???????????????????????\????????????????????????????????????????????? */
BOOL solveProblem(int n, BoardStatus boardStatus);

/* ?????¢????????? */
/* ?????°   : in    queenPosition ???????????????????????????????????´????????¨?????????(index????????????, ????????????????????¨???) */
/* ??????   : ???????????????????????????????????´??????'Q', ????????\??????'.'??§?????¢(?????????)????????? */
void dispBoard(const int queenPosition[]);

size_t getLine(Input *input, char* buf, size_t bufSize);
Input * createInputByFile(char * filePath);
Input * createInputByStdin();

/* ???????????¢??° */
int main(void) {

	BoardStatus boardStatus = { 0 }; /* ????????????????????????????????????????????¢?????¶??? */
	int solvedResult; /* solveProblem?????????????????\?????? */

	/* ???????????????????????\????????????????????? */
	if (presetQueen(BY_FILE, &boardStatus) == FALSE) {
		return 1;
	}
	//presetQueen(BY_STDIN);

	/* ??????????§£??? */
	solvedResult = solveProblem(0, boardStatus);

	return 0;

}

/* ??\?????¢??° */
BOOL presetQueen(int inputType, BoardStatus *boardStatus) {

	Input *input;
	char buf[MAX_BUF + 1]; /* ??????????????§??????1??????????????? */
	size_t lineLen = 0;	/* ?????????????????????????????? */
	int k;	/* ????????????????????????????????????????????° */
	int row, column;	/* ????????????????????? */
	int rowDigit = 1; /* row????????° */
	int i;

	/* ??????????????\????????? */
	if (inputType == BY_FILE) {
		input = createInputByFile(INPUT_FILE_NAME);
		lineLen = getLine(input, buf, MAX_BUF);
		k = atoi(buf);
		if (k < 0 || QUEEN_NUM + 1 < k) {
			//????????????????????????
			fclose(input->inputFile);
			printf("k??????????????§??????????????°???????????????????????????");
				return FALSE;
		}
	}
	else {	/* ?¨??????\????????? */
		input = createInputByStdin();

		while (1) {
			lineLen = getLine(input, buf, MAX_BUF);
			k = atoi(buf);
			if (k < 0 || QUEEN_NUM + 1 < k) {
				printf("k??????????????§????????£??????????????\????????????????????????");
			}
			else {
				break;
			}
		}
	}

	for (i = 0; i < k; i++) {
		/* r???c?????\??? */
		lineLen = getLine(input, buf, MAX_BUF);
		sscanf(buf, "%d", &row);
		/* r????????°????±??????? */
		if (row != 0) {
			rowDigit = (int)log10(row) + 1;
		}
		sscanf(&buf[rowDigit + 1], "%d", &column);

		/* ?????????????????????????????? */
		if (!boardStatus->advanceFlag[row] && 
			!boardStatus->verticalFlag[column] && 
			!boardStatus->rightUpwardFlag[row + column] && 
			!boardStatus->rightDownwardFlag[row - column + (QUEEN_NUM-1)] ) {

			boardStatus->queenPosition[row] = column; /* ????????????????????? */

			/* ????????°???1?????????(????????????????????????????????????????????????????????¶????????????) */
			boardStatus->advanceFlag[row] = 1;
			boardStatus->verticalFlag[column] = 1;
			boardStatus->rightUpwardFlag[row + column] = 1;
			boardStatus->rightDownwardFlag[row - column + (QUEEN_NUM -1)] = 1;
		}
		else {
			printf("?????????????????????????????????????????°???????????????????????????");
			return FALSE;
		}
	}
	return TRUE;
}

/* ??????????§£?????¢??° */
BOOL solveProblem(int n, BoardStatus boardStatus) {

	int i;

	/* ???????????\?????§n????????????????????????????????????????????????????????????????£???°??? */
	while (boardStatus.advanceFlag[n] && n < QUEEN_NUM) {
		n++;
	}

	/* 7????????????????????????????????????????§£????????? */
	if (n == QUEEN_NUM) {
		dispBoard(boardStatus.queenPosition);
		return TRUE;
	}

	for (i = 0; i <= (QUEEN_NUM - 1); i++) {
		if (!boardStatus.verticalFlag[i] &&
			!boardStatus.rightUpwardFlag[n + i] &&
			!boardStatus.rightDownwardFlag[n - i + (QUEEN_NUM - 1)]) {

			/* n???i??????????????????????????? */
			boardStatus.queenPosition[n] = i;
			
			/* n???i????????±?????????????????°???1?????????(?????????????????????????????????????????????????????????????????¶????????????) */
			boardStatus.verticalFlag[i] = 1;
			boardStatus.rightUpwardFlag[n + i] = 1;
			boardStatus.rightDownwardFlag[n - i + (QUEEN_NUM - 1)] = 1;

			/* ?????°???????????? */
			if (solveProblem(n + 1, boardStatus) == TRUE) {
				return TRUE;
			}

			/* ????????°???????????????(??????????????????????????¶????????????) */
			boardStatus.verticalFlag[i] = 0;
			boardStatus.rightUpwardFlag[n + i] = 0;
			boardStatus.rightDownwardFlag[n - i + (QUEEN_NUM - 1)] = 0;

		}
	}
	return FALSE;

}

/* ????????????????????¢??° */
void dispBoard(const int queenPosition[]) {

	int i, j;

	for (i = 0; i <= (QUEEN_NUM - 1); i++) {
		/*printf("%d ", queenPosition[i]);*/
		for (j = 0; j <= (QUEEN_NUM - 1); j++) {
			/* ???????????????????????????????????° */
			if (j == queenPosition[i]) {
				printf("Q");
			}
			else {
				printf(".");
			}
		}
		printf("\n");
	}
}

/* 1????????????????????§buf???????´????buf?????????????????? */
size_t getLine(Input *input, char* buf, size_t bufSize)
{
	if ((fgets(buf, bufSize, input->inputFile)) == NULL)
	{
		return 0;
	}

	if (input->inputFile != stdin) {
		printf("%s", buf);
	}

	size_t size = 0;
	while (buf[size + 1] != '\0') {
		size++;
	}
	return size;
}

Input * createInputByFile(char * filePath)
{
	Input* ret = NULL;
	FILE* fp = NULL;

	if ((fp = fopen(filePath, "r")) != NULL) {
		ret = malloc(sizeof(Input));
		ret->inputFile = fp;
	}

	//errno_t err = fopen_s(&fp, filePath, "r");
	//if (fp != NULL && err == 0) {
	//	ret = malloc(sizeof(Input));
	//	/* set members of Input */
	//	ret->inputFile = fp;
	//}

	return ret;
}

Input * createInputByStdin()
{
	Input* ret = NULL;
	ret = malloc(sizeof(Input));
	ret->inputFile = stdin;

	return ret;
}

Compiler output:
main.c:5:10: fatal error: windows.h: No such file or directory
    5 | #include <windows.h>
      |          ^~~~~~~~~~~
compilation terminated.