## binnaman

this is what I have so far. I did most of the work just that my output is screwed

``````#include <iostream>
#include <fstream>
#include <stack>
#include <cmath>
#include <cassert>

using namespace std;

int number();

bool Valid( stack<int> s, int row){// This will find out if there is a valid solution for the K by K int given.
stack<int> hold;
int column(0);
int ORow(0);
int OCol(0);
if(!s.empty()){
column = s.top();
hold.push(s.top());
s.pop();
}
if(!s.empty()){
OCol = s.top();
ORow = row - 1;
}
if((column == OCol)||(abs(column - OCol) == abs(row - ORow))){
}
else{
hold.push(s.top());
s.pop();
}
if(!s.empty()){
OCol = s.top();
ORow = ORow - 1;
}
}
}

void Advance(stack<int> & s, int & rows, const int k){// This sees if there is any complication between the queens
int number(0);

while(!s.empty() && s.top() == k){
s.pop();
rows = rows - 1;
}
if(!s.empty()){
number = s.top() + 1;
s.pop();
s.push(number);
}
}
int main(int integer){//Initialization of all functions and output of queens problem using an array..
stack<int> s;
int rows(0);
int k(0);
bool goodMove(false);
bool NA(false);
int array[integer];
int index(integer-1);
int row(1);

cout << "Input Size of Chessboard." << endl;
cin >> k;

s.push(1);
rows = rows + 1;

while(!goodMove && !s.empty()){
NA = Valid( s, rows);
if(NA)
else if(!NA && (s.size() == k))
goodMove = true;
else{
s.push(1);
rows = rows + 1;
}
}
if(goodMove){
while(!s.empty()){
array[index] = s.top();
s.pop();
index = index - 1;
}
while(row <= integer){
index = index + 1;
cout << "Row "<< row << " Column "<< array[index] << endl;
row = row + 1;
}
}
else{
cout << "No solution"  <<endl;
}

return 0;
}``````

## Nick Evan 4,005

"my output is screwed" is not a great description of your problem.
Please explain what output you are expecting, and what output you get.
Also explain what the program is suppose to do.

Niek