Language: C

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
using namespace std;

int dx[] = { 1,1,1,0,0,-1,-1,-1 };
int dy[] = { 1,0,-1,1,-1,1,0,-1 };

bool flag = false;

void dfs(char table[8][8], int k, int i, int j) {
	int m, n;
	if (k == 7) {
		table[i][j] = 'Q';
		for (m = 0; m < 8; m++) {
			for (n = 0;; n++) {
				if (i + n*dx[m] < 0 || i + n*dx[m]>8 || j + n*dy[m] < 0 || j + n*dy[m]>8) break;
				if (table[i + n*dx[m]][j + n*dy[m]] != 'Q') {
					table[i + n*dx[m]][j + n*dy[m]] = '.';
				}
			}
		}
		for (m = 0; m < 8; m++) {
			for (n = 0; n < 8; n++) {
				printf("%c", table[m][n]);
			}
			printf("\n");
		}
		flag = true;
		return;
	}
	char copytable[8][8] = { 0 };
	for (m = 0; m < 8; m++) {
		for (n = 0; n < 8; n++) {
			copytable[m][n] = table[m][n];
		}
	}
	copytable[i][j] = 'Q';
	
	for (m = 0; m < 8; m++) {
		for (n = 0;; n++) {
			if (i + n*dx[m] < 0 || i + n*dx[m]>8 || j + n*dy[m] < 0 || j + n*dy[m]>8) break;
			if (copytable[i + n*dx[m]][j + n*dy[m]] != 'Q') {
				copytable[i + n*dx[m]][j + n*dy[m]] = '.';
			}
		}
	}
	for (m = 0; m < 8; m++) {
		for (n = 0; n < 8; n++) {
			if (flag == false) {
				if (copytable[m][n] == '0') {
					dfs(copytable, k + 1, m, n);
				}
			}
		}
	}
}


int main() {
	int k, c, r;
	int i, j, count;
	char table[8][8] = { 0 };
	memset(table, '0', sizeof(table));
	scanf("%d", &k);
	count = k;
	while (count--) {
		scanf("%d%d", &c, &r);
		for (i = 0; i < 8; i++) {
			for (j = 0;; j++) {
				if (c + j*dx[i] < 0 || c + j*dx[i]>=8 || r + j*dy[i] < 0 || r + j*dy[i]>=8) break;
				table[c+j*dx[i]][r+j*dy[i]] = '.';
			}
		}
		table[c][r] = 'Q';
	}
	for (i = 0; i < 8; i++) {
		for (j = 0; j < 8; j++) {
			if (table[i][j] == '0') {
				dfs(table, k, i, j);
				if (flag == true) {
					goto end;
				}
			}
		}
	}
end:;
	
	return 0;
}


Compiler output:
main.c:4:1: error: unknown type name 'using'
    4 | using namespace std;
      | ^~~~~
main.c:4:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
    4 | using namespace std;
      |                 ^~~
main.c:9:1: error: unknown type name 'bool'
    9 | bool flag = false;
      | ^~~~
main.c:4:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    3 | #include<string.h>
  +++ |+#include <stdbool.h>
    4 | using namespace std;
main.c:9:13: error: 'false' undeclared here (not in a function)
    9 | bool flag = false;
      |             ^~~~~
main.c:9:13: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c: In function 'dfs':
main.c:29:24: error: 'true' undeclared (first use in this function)
   29 |                 flag = true;
      |                        ^~~~
main.c:29:24: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:29:24: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:81:45: error: 'true' undeclared (first use in this function)
   81 |                                 if (flag == true) {
      |                                             ^~~~
main.c:81:45: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'