Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> skrypt rysujący szachownice
pawel12
post
Post #1





Grupa: Zarejestrowani
Postów: 1
Pomógł: 0
Dołączył: 15.08.2006

Ostrzeżenie: (0%)
-----


Witam.Mam problem ze skryptem rysującym coś w stylu szachownicy, której pola zastąpione są "x" i "#".Problem polega na tym że skrypt wyświetla:

x#x#x#x#x#x
#x#x#x#x#x#
x#x#x#x#x#x

x#x#x#x#x#x

x#x#x#x#x#x

x#x#x#x#x#x

x#x#x#x#x#x
a powinien:
x#x#x#x#x#x
#x#x#x#x#x#
x#x#x#x#x#x
#x#x#x#x#x#
x#x#x#x#x#x
#x#x#x#x#x#
x#x#x#x#x#x
#x#x#x#x#x#
x#x#x#x#x#x
#x#x#x#x#x#
x#x#x#x#x#x

  1. <?
  2. $j=12;
  3. $l=1;
  4. $i=1;
  5. $k=1;
  6. for ($i=1;$i<$j;$i++) {
  7. if(($i==1)|($i==3)|($i==5)|($i==7)|($i==9)|($i==11)){
  8. for($k=1;$k<$j;$k++){
  9. if(($k==1)|($k==3)|($k==5)|($k==7)|($k==9)|($k==11)){
  10. print("x");
  11. }else { print("#");}
  12.  
  13. }
  14. print("<br>");
  15. } if(($i==2)|($i==4)|($i==6)|($i==8)|($i==10)|($i==12)){
  16. for($l==1;$l<$j;$l++){
  17. if(($l==2)|($l==4)|($l==6)|($l==8)|($l==10)|($l==12)){
  18. print("");
  19. }else {print("#");}
  20. }
  21. print("<br>");
  22. }
  23.  
  24. }
  25.  
  26. ?>


Ten post edytował pawel12 15.08.2006, 18:57:30
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 6.10.2025 - 22:54