What's new

Turbo pascal Error 8

Joined
Nov 4, 2008
Messages
42
Reaction score
1
Elo ucze sie programowa? i czyta?em poradniki itp. zrobi?em tak jak tam pisa?o lecz mi wyskakuje b??d
Error 8 : String costant exceeds line.
pomurzcie co mam zrobi? z g?ry thx
 
K

Krecioo

Guest
Odp: Turbo pascal Error 8

Po pierwsze nie ucz si? PASCALA bo to syf, zamiast tego naucz si? C++. No chyba, ?e w szkole ci? ucz? to musisz przecierpie?. Po drugie kiedy ci to wyskakuje, podczas kompilacji? Je?li tak to wy?lij mi na PW kod mo?e pomog?.
 

Smok_

Active User
Joined
Apr 23, 2008
Messages
125
Reaction score
20
Odp: Turbo pascal Error 8

Sam jeste? syf :p (bez obrazy).
Pascal to podstawowy j?zyk, kt?ry musisz umie?!
# String constant exceeds line - Sta?a ?a?cuchowa przekracza wiersz
 

pomocny92

Active User
Joined
Jun 2, 2008
Messages
62
Reaction score
0
Odp: Turbo pascal Error 8

Prawdopodobnie nie masz na ko?cu jakiego? wiersza ?rednika ;. Np po komendie writeln('bla bla bla') <-
 

ald890

Active User
Joined
Nov 16, 2008
Messages
73
Reaction score
6
Odp: Turbo pascal Error 8

Pascal rox(zaraz po cpp, java) :D Moja 1 gra :)
program labirynty;

uses crt;
{==============INICJALIZACJE ZMIENNYCH=========}
var tab:array[1..20,1..20]of byte;
iz,io,ia,cz,co,ca,z,x,y,px,py,pm,pozx,pozy:integer;
lab:array[1..20,1..20]of char;
abc,a:char;

{=============INICJALIZACJE PROCEDUR=======}


{===========RYSOWANIE TABELI=============}
procedure rysujt;
begin
for y:=1 to 20 do
begin
for x:=1 to 20 do
begin
textcolor(95);
gotoxy(px+x,py+y);
if tab[x,y]=0 then begin textcolor(108); write(' ');end;
if tab[x,y]=1 then begin textcolor(212); write(#219);end;
if tab[x,y]=2 then write(#15);
if tab[x,y]=3 then write(#2);
if tab[x,y]=4 then write('#');
if tab[x,y]=5 then write('+');

end;
writeln;
end;
end;
{==========RESTART MIEJSC W TABELI========}
procedure restabeli;
begin
lab[1]:= '11111111111111111111';
lab[2]:= '12000010000000000001';
lab[3]:= '10111030110113101101';
lab[4]:= '10101111100110101001';
lab[5]:= '10100000000110001001';
lab[6]:= '10001111010111101101';
lab[7]:= '11111500010000100031';
lab[8]:= '10000013110110111151';
lab[9]:= '10111110010110000111';
lab[10]:='10003000010011110101';
lab[11]:='11111100011310000101';
lab[12]:='10000100003000000001';
lab[13]:='10111101101111111131';
lab[14]:='10050001001400100001';
lab[15]:='11110111001110101111';
lab[16]:='10000103000010100001';
lab[17]:='10110111111010111101';
lab[18]:='10000000010010111101';
lab[19]:='15000100030010000031';
lab[20]:='11111111111111111111';
for y:=1 to 20 do
begin
for x:=1 to 20 do
begin
if lab[y,x]='1' then tab[x,y]:=1;
if lab[y,x]='2' then tab[x,y]:=2;
if lab[y,x]='3' then tab[x,y]:=3;
if lab[y,x]='4' then tab[x,y]:=4;
if lab[y,x]='5' then tab[x,y]:=5;
if lab[y,x]='0' then tab[x,y]:=0;
end;
end;
pozx:=2;
pozy:=2;
end;

{============ZACHOWANIE POTWORA===========}
procedure potwor;
begin
z:=1;
iz:=random(5)+15;
ia:=random(3)+4;
io:=random(2)+2;

ca:=random(4)+4;
co:=random(2)+3;

repeat;
clrscr;
gotoxy(25,10);
writeln('Potwor');gotoxy(25,11);
writeln('ZYCIE ',iz);gotoxy(25,12);
writeln('ATAK ',ia);gotoxy(25,13);
writeln('OBRONA ',io);

gotoxy(45,10);
writeln('Rycerz Czeslaw');gotoxy(45,11);
writeln('ZYCIE ',cz);gotoxy(45,12);
writeln('ATAK ',ca);gotoxy(45,13);
writeln('OBRONA ',co);

writeln('1) Atakuj! ');
writeln('2) Uciekaj! ');
a:=readkey;

case a of
'1':begin;
iz:=iz-ca+io;
cz:=cz-ia+co;
if (iz<=0) then
begin
write(' Wygrales!'); z:=2;
end;
if (cz<=0) then begin write(' Czesio przepadl'); z:=2;a:=#27; end;
end;

'2': begin write(' Kara -6hp'); cz:=cz-6; z:=2; end;
end;

gotoxy(25,10);
writeln('Potwor');gotoxy(25,11);
writeln('ZYCIE ',iz);gotoxy(25,12);
writeln('ATAK ',ia);gotoxy(25,13);
writeln('OBRONA ',io);

gotoxy(45,10);
writeln('Rycerz Czeslaw');gotoxy(45,11);
writeln('ZYCIE ',cz);gotoxy(45,12);
writeln('ATAK ',ca);gotoxy(45,13);
writeln('OBRONA ',co);

writeln('1) Atakuj! ');
writeln('2) Uciekaj! ');

until z=2;
delay(2000);clrscr;
end;


{HEALTH POTION}
procedure potion;
begin
cz:=cz+5;
write('Znalazles miksture zycia +5hp!'); delay(1000);
clrscr;
end;
{=============RUCH==============}
procedure ruch;
begin
repeat
rysujt;
a:=readkey;
case a of
'w':begin
if tab[pozx,pozy-1]=0 then begin tab[pozx,pozy]:=0;pozy:=pozy-1;tab[pozx,pozy]:=2;end;
if tab[pozx,pozy-1]=5 then begin tab[pozx,pozy]:=0;pozy:=pozy-1;tab[pozx,pozy]:=2;potion;end;
if tab[pozx,pozy-1]=3 then begin tab[pozx,pozy]:=0;pozy:=pozy-1;tab[pozx,pozy]:=2;potwor;end;
if tab[pozx,pozy-1]=4 then begin tab[pozx,pozy]:=0;pozy:=pozy-1;tab[pozx,pozy]:=2;
writeln('Czesio ucieka! Wygrales');delay(2000);a:=#27;end;
end;
's':begin
if tab[pozx,pozy+1]=0 then begin tab[pozx,pozy]:=0;pozy:=pozy+1;tab[pozx,pozy]:=2;end;
if tab[pozx,pozy+1]=5 then begin tab[pozx,pozy]:=0;pozy:=pozy+1;tab[pozx,pozy]:=2;potion;end;
if tab[pozx,pozy+1]=3 then begin tab[pozx,pozy]:=0;pozy:=pozy+1;tab[pozx,pozy]:=2;potwor;end;
if tab[pozx,pozy+1]=4 then begin tab[pozx,pozy]:=0;pozy:=pozy+1;tab[pozx,pozy]:=2;
writeln('Czesio ucieka! Wygrales');delay(2000);a:=#27;end;
end;
'a':begin
if tab[pozx-1,pozy]=0 then begin tab[pozx,pozy]:=0;pozx:=pozx-1;tab[pozx,pozy]:=2;end;
if tab[pozx-1,pozy]=5 then begin tab[pozx,pozy]:=0;pozx:=pozx-1;tab[pozx,pozy]:=2;potion;end;
if tab[pozx-1,pozy]=3 then begin tab[pozx,pozy]:=0;pozx:=pozx-1;tab[pozx,pozy]:=2;potwor;end;
if tab[pozx-1,pozy]=4 then begin tab[pozx,pozy]:=0;pozx:=pozx-1;tab[pozx,pozy]:=2;
writeln('Czesio ucieka! Wygrales');delay(2000);a:=#27;end;
end;
'd':begin
if tab[pozx+1,pozy]=0 then begin tab[pozx,pozy]:=0;pozx:=pozx+1;tab[pozx,pozy]:=2;end;
if tab[pozx+1,pozy]=5 then begin tab[pozx,pozy]:=0;pozx:=pozx+1;tab[pozx,pozy]:=2;potion;end;
if tab[pozx+1,pozy]=3 then begin tab[pozx,pozy]:=0;pozx:=pozx+1;tab[pozx,pozy]:=2;potwor;end;
if tab[pozx+1,pozy]=4 then begin tab[pozx,pozy]:=0;pozx:=pozx+1;tab[pozx,pozy]:=2;
writeln('Czesio ucieka! Wygrales');delay(2000);a:=#27;end;
end;
end;
until a=#27;
end;
{=============MENU==============}
procedure menu;
begin
randomize;
gotoxy(33,21);
textcolor(128);
write(' ');
gotoxy(33,22);
if pm=1 then
begin
textcolor(140);
writeln(' ',#16,' NOWA GRA ');
end

else
begin
textcolor(128);
Writeln(' Nowa gra ');
end;
gotoxy(33,23);
if pm=2 then
begin
textcolor(140);
writeln(' ',#16,' INSTRUKCJA');
end

else
begin
textcolor(128);
Writeln(' Instrukcja ');
end;
gotoxy(33,24);
if pm=3 then
begin
textcolor(140);
writeln(' ',#16,' HISTORIA ');
end

else
begin
textcolor(128);
Writeln(' Historia ');
end;
gotoxy(33,25);
if pm=4 then
begin
textcolor(140);
writeln(' ',#16,' AUTOR ');
end

else
begin
textcolor(128);
Writeln(' Autor ');
end;
gotoxy(33,26);
if pm=5 then
begin
textcolor(140);
writeln(' ',#16,' KONIEC ');
end

else
begin
textcolor(128);
Writeln(' Koniec ');
end;
gotoxy(33,27);
write(' ');
end;

{==========INSTRUKCJA===============}
procedure instrukcja;
begin
write('Sterowanie: w - gora, s - dol, a - lewo, d - prawo');
end;

{=========HISTORIA==================}
procedure historia;
begin
write('Rycerz Czeslaw zagubil sie w labiryncie, musisz mu pomoc sie z niego wydostac! Powodzenia.');
end;

{=========AUTOR=====================}
procedure autor;
begin;
write('Ald890');
end;

{=======STEROWANIE W MENU==========}
procedure sterm;
begin

menu;
abc:=readkey;

if (abc='w')and (pm>1) then pm:=pm-1;
if (abc='s')and (pm<5) then pm:=pm+1;
if abc=#13 then
begin
case pm of
1:begin
restabeli;
clrscr;
ruch;
end;
2:begin clrscr; instrukcja;readkey; end;
3:begin clrscr; historia;readkey; end;
4:begin clrscr; autor;readkey; end;
5:pm:=6;
end;
end;
end;

{=================P?TLA G??WNA========================}
begin
pm:=1;
px:=29;
py:=14;
cz:=60;
textcolor(95);
repeat
sterm;
until pm=6;
end.
{====================KONIEC===========================}
Masz tu podstawe spr?buj to fajnie dopracowa? ^^
 
Last edited:
Top