Question: complete the 1demension 8 queen promblem using the given format and without using goto statement #include #include using namespace std; bool ok(int q[], int c)
complete the 1demension 8 queen promblem using the given format and without using goto statement
#include
bool ok(int q[], int c) { for (int i = 0; i < c; i++) { if (q[i] == q[c] || c - i == abs(q[i] - q[c])) { return false; } } return true; }
void goBack(int c){ }
void print(int q[]) { }
int main() { int q[8] = {0}; int c = 0; while ( ) { if ( ) { } else if () { } else if () { } else { } } return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
