By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,233 Members | 1,774 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,233 IT Pros & Developers. It's quick & easy.

hi

P: n/a
Hello everyone I am high school student and I need everyone's help. So
I have to do a program in C++, I must place 9 queens in chess table
without matching one with another. I already placed eight queens but
nine is imposible, can somebone please help me...

Nov 27 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
* de******@yahoo.com:
Hello everyone I am high school student and I need everyone's help. So
I have to do a program in C++, I must place 9 queens in chess table
without matching one with another. I already placed eight queens but
nine is imposible, can somebone please help me...


9 queens is impossible under ordinary rules of chess, since at least one
row must then contain at least 2 queens.

This is, however, OFF-TOPIC in [comp.lang.c++].

Follow-ups therefore set to [comp.programming], and please post to
appropriate forums.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Nov 27 '05 #2

P: n/a
de******@yahoo.com wrote:
Hello everyone I am high school student and I need everyone's help. So
I have to do a program in C++, I must place 9 queens in chess table
without matching one with another. I already placed eight queens but
nine is imposible, can somebone please help me...


Nine is impossible, even in C++.

Think aout it, a chess board is 8x8, so with nine queens at least two
queen must be on the same row. Therefore they attack each other,
therefore nine queens is impossible.

john
Nov 27 '05 #3

P: n/a
In article <CW******************@newsfe4-win.ntli.net>,
John Harrison <jo*************@hotmail.com> wrote:
de******@yahoo.com wrote:
Hello everyone I am high school student and I need everyone's help. So
I have to do a program in C++, I must place 9 queens in chess table
without matching one with another. I already placed eight queens but
nine is imposible, can somebone please help me...


Nine is impossible, even in C++.

Think aout it, a chess board is 8x8, so with nine queens at least two
queen must be on the same row. Therefore they attack each other,
therefore nine queens is impossible.

john


Actually, a better answer is "You haven't given us enough information". A
more interesting problem is placing N queens on an NxN board with no two
queens attacking each other. It's trivial to prove, for example, that this
is impossible for N=2. Maybe he was talking about solving this, more
complex, problem for N=9?
Nov 27 '05 #4

P: n/a
Roy Smith wrote:
In article <CW******************@newsfe4-win.ntli.net>,
John Harrison <jo*************@hotmail.com> wrote:

de******@yahoo.com wrote:
Hello everyone I am high school student and I need everyone's help. So
I have to do a program in C++, I must place 9 queens in chess table
without matching one with another. I already placed eight queens but
nine is imposible, can somebone please help me...


Nine is impossible, even in C++.

Think aout it, a chess board is 8x8, so with nine queens at least two
queen must be on the same row. Therefore they attack each other,
therefore nine queens is impossible.

john

Actually, a better answer is "You haven't given us enough information". A
more interesting problem is placing N queens on an NxN board with no two
queens attacking each other. It's trivial to prove, for example, that this
is impossible for N=2. Maybe he was talking about solving this, more
complex, problem for N=9?


Maybe, its quite advanced programming for high school, so I'm not sure
what is really going on.

In any case if he has solved it for eight, then solving it for nine is easy.

OP, post your solution for eight and explain why you can't do the same
for nine.

john
Nov 27 '05 #5

P: n/a

"John Harrison" <jo*************@hotmail.com> wrote in message
news:41****************@newsfe6-win.ntli.net...
Roy Smith wrote:
In article <CW******************@newsfe4-win.ntli.net>,
John Harrison <jo*************@hotmail.com> wrote:

de******@yahoo.com wrote:

Hello everyone I am high school student and I need everyone's help. So
I have to do a program in C++, I must place 9 queens in chess table
without matching one with another. I already placed eight queens but
nine is imposible, can somebone please help me...
Nine is impossible, even in C++.

Think aout it, a chess board is 8x8, so with nine queens at least two
queen must be on the same row. Therefore they attack each other,
therefore nine queens is impossible.

john

Actually, a better answer is "You haven't given us enough information".
A more interesting problem is placing N queens on an NxN board with no
two queens attacking each other. It's trivial to prove, for example,
that this is impossible for N=2. Maybe he was talking about solving
this, more complex, problem for N=9?


Maybe, its quite advanced programming for high school, so I'm not sure
what is really going on.

In any case if he has solved it for eight, then solving it for nine is
easy.

OP, post your solution for eight and explain why you can't do the same for
nine.


I take it you don't play chess? A queen in chess can attack across a row, a
column or diagonally. So for his problem he can not have 2 queens in the
same row, column or diagonal. This can be done with 8 queens on an 8x8
chessboard, but is impossible for 9 queens on an 8x8 chessboard because 2
queens must be on the same row (or column. It's both actually)
May 1 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.