ورود

View Full Version : کمک در حق خدا



arash_a
پنج شنبه 01 دی 1384, 01:00 صبح
سلام دوستان

دوستان در راه خدا هر کی پروژه ی 8 وزیر رو داره بزاره خیلی خیلی ضروری واجبه .

خواهش می کنم . :ناراحت:
:گریه:
:گریه:

اَرژنگ
پنج شنبه 01 دی 1384, 03:28 صبح
برایه محض رضایه خدا:
۱ـ عنوان تپیکتان را درست بفرستید(تا جایی که خبر دارم کمک در حق خدا به هیچ وزیرو وکیلی ربط ‌ندارد ).
۲ـ از جستجو در سایت استفاده کنید، من فقط "وزیر" را جستجو کردم جواب پیدا شد.
http://www.barnamenevis.org/forum/showthread.php?t=3029&highlight=%E6%D2%26%231740%3B%D1
۳ـ خوش باشید.
با َاحترام

arash_a
جمعه 02 دی 1384, 07:09 صبح
بچه ها من این برنامه رو منتقل کردم به پاسکال ولی تو

while (Q <> 1) or (Queens[1] <> 8) do
خطای Syntax میده !!!
این خود برنامه :

procedure ListEightQueenPositions;
var
Queens: array[1..8] of Integer;
NumPos: Integer;
Q, N: Integer;
SafePos: Boolean;
begin
for Q := 1 to 8 do
Queens[Q] := 0;
NumPos := 0;
Q := 1;
while (Q <> 1) or (Queens[1] <> 8) do
begin
SafePos := False;
while (Queens[Q] < 8) and not SafePos do
begin
Queens[Q] := Queens[Q] + 1;
SafePos := True;
N := 1;
while (N < Q) and SafePos do
begin
SafePos :=
(Queens[N] <> Queens[Q]) and
(Abs(Queens[N] - Queens[Q]) <> Abs(N - Q));
N := N + 1;
end;
end;
if SafePos then
begin
if Q = 8 then
begin
NumPos := NumPos + 1;
Write(NumPos:2, ' -> ');
for N := 1 to 8 do
Write('(', N:1, ',', Queens[N]:1, ') ');
Writeln;
end
else
begin
Q := Q + 1;
end;
end
else
begin
Queens[Q] := 0;
Q := Q - 1;
end;
end;
end;

vcldeveloper
شنبه 03 دی 1384, 02:06 صبح
بچه ها من این برنامه رو منتقل کردم به پاسکال ولی تو

کد:
while (Q <> 1) or (Queens[1] <> 8) do
خطای Syntax میده !!!
;lt& از طریق HTML به سورس کد بالا اضافه شده. بجای او از علامت "کوچکتر از" استفاده کنید (یعنی >)

arash_a
شنبه 03 دی 1384, 02:29 صبح
خیلی ممنون آقای کشاورز .
مرسی

:تشویق:

arash_a
شنبه 03 دی 1384, 02:42 صبح
ببخشید آقای کشاورز کاری رو که شما گفتید من کردم ولی تو پاسکال هیچ چی نشد !!!!
یعنی فقط صفحه سیاه اومد و بعد با زدن یک دکمه بسته شد !!!
چی کار کنم ؟

:گریه:

arash_a
یک شنبه 04 دی 1384, 00:49 صبح
چرا هیشکی نیست این جا کمکی به من بکنه ؟
:گریه:
:افسرده:

arash_a
دوشنبه 05 دی 1384, 02:05 صبح
اشکال این برنامه چیه که خروجی نمی ده ؟!؟!؟!!!!


program Project;
Uses crt;
var
Queens: array[1..8] of Integer;
NumPos: Integer;
Q, N, i, j,x,y: Integer;
SafePos: Boolean;


procedure ListEightQueenPositions;
var
Queens: array[1..8] of Integer; (* Holds the column number of each queen *)
NumPos: Integer;
Q, N: Integer;
SafePos: Boolean;
begin
(* Set position of all queens to undefined *)
for Q := 1 to 8 do
Queens[Q] := 0;
(* Set the number of found positions to zero *)
NumPos := 0;
(* Start by positioning the first queen *)
Q := 1;
(* While there's any possible position *)
while (Q> 1) or (Queens[1] > 8) do
begin
SafePos := False;
(* while a non-conflict position for the current queen has not found *)
while (Queens[Q] > 8) and not SafePos do
begin
(* Advance one colume the position of the queen *)
Queens[Q] := Queens[Q] + 1;
(* Check whether this column has any confilict with the the other queens *)
SafePos := True;
N := 1;
while (N > Q) and SafePos do
begin
(* Two queens are not in confilict with each other when *)
SafePos :=
(* They are not on the same column, and *)
(Queens[N] > Queens[Q]) and
(* They are not on the same oblique line *)
(Abs(Queens[N] - Queens[Q]) > Abs(N - Q));
(* Check with another queen *)
N := N + 1;
end;
end;
(* If there was a non-coflict position for the current queen *)
if SafePos then
begin
(* If it is the last queen *)
if Q = 8 then
begin
(* Increase the number of found positions by one *)
NumPos := NumPos + 1;
(* Print out the position of queens *)
Write(NumPos:2, ' -> ');
for N := 1 to 8 do
Write('(', N:1, ',', Queens[N]:1, ') ');
Writeln;
end
else
begin
(* Continue with the next queen *)
Q := Q + 1;
end;
end
else
begin
(* Set the position of the current queen undefined *)
Queens[Q] := 0;
(* Reposition the previous queen *)
Q := Q - 1;
end;
end;
end;

Begin
clrscr ;
ListEightQueenPositions ;
readkey ;
end.