danonix
09-07-2013, 02:06 PM
Hello, so we in school have started programic lessons from pascal basics. When I wrote a program that should randomly on screen write word. Everything is fine until it starts to printing. After 1-2 loops pascal prints: exitcode = 201. Is someone able to tell me reason of that? And why it prints? Here is the code. Thanks for help.
program disco_na_ekranie;
uses crt;
var
a,a1,b,b1,c,c1,d,d1,e,e1,f,f1,g,g1,i:integer;
slowo:string[10];
begin
clrscr;
textcolor(green);
writeln('Witaj w programie Disco Na Ekranie');
writeln('Wpisz slowo, jakie ma byc wyswietlone - max 10 znakow');
writeln('Jezeli tekst bedzie za dlugi zostanie automatycznie skrocony');
readln(slowo);
clrscr;
textcolor(yellow);
writeln('Wybrales slowo: ',slowo);
delay(10000);
textcolor(red);
Writeln('Impreza rozpocznie sie za...');
writeln('5...');
textcolor(green);
delay(1000);
textcolor(white);
writeln('4...');
delay(1000);
textcolor(cyan);
writeln('3...');
delay(1000);
textcolor(magenta);
writeln('2...');
delay(1000);
textcolor(blue);
writeln('1...');
delay(1000);
clrscr;
for i:=1 to 15 do
begin
randomize;
a:=random(50);
a1:=random(50);
b:=random(50);
b1:=random(50);
c:=random(50);
c1:=random(50);
d:=random(50);
d1:=random(50);
e:=random(50);
e1:=random(50);
f:=random(50);
f1:=random(50);
g:=random(50);
g1:=random(50);
textcolor(white);
gotoxy(a,a1);
write(slowo);
delay(200);
textcolor(red);
gotoxy(b,b1);
write(slowo);
delay(200);
textcolor(green);
gotoxy(c,c1);
write(slowo);
delay(200);
textcolor(yellow);
gotoxy(d,d1);
write(slowo);
delay(200);
textcolor(blue);
gotoxy(e,e1);
write(slowo);
delay(200);
textcolor(cyan);
gotoxy(f,f1);
write(slowo);
delay(200);
textcolor(lightblue);
gotoxy(g,g1);
write(slowo);
delay(200);
end;
readln;
end.
program disco_na_ekranie;
uses crt;
var
a,a1,b,b1,c,c1,d,d1,e,e1,f,f1,g,g1,i:integer;
slowo:string[10];
begin
clrscr;
textcolor(green);
writeln('Witaj w programie Disco Na Ekranie');
writeln('Wpisz slowo, jakie ma byc wyswietlone - max 10 znakow');
writeln('Jezeli tekst bedzie za dlugi zostanie automatycznie skrocony');
readln(slowo);
clrscr;
textcolor(yellow);
writeln('Wybrales slowo: ',slowo);
delay(10000);
textcolor(red);
Writeln('Impreza rozpocznie sie za...');
writeln('5...');
textcolor(green);
delay(1000);
textcolor(white);
writeln('4...');
delay(1000);
textcolor(cyan);
writeln('3...');
delay(1000);
textcolor(magenta);
writeln('2...');
delay(1000);
textcolor(blue);
writeln('1...');
delay(1000);
clrscr;
for i:=1 to 15 do
begin
randomize;
a:=random(50);
a1:=random(50);
b:=random(50);
b1:=random(50);
c:=random(50);
c1:=random(50);
d:=random(50);
d1:=random(50);
e:=random(50);
e1:=random(50);
f:=random(50);
f1:=random(50);
g:=random(50);
g1:=random(50);
textcolor(white);
gotoxy(a,a1);
write(slowo);
delay(200);
textcolor(red);
gotoxy(b,b1);
write(slowo);
delay(200);
textcolor(green);
gotoxy(c,c1);
write(slowo);
delay(200);
textcolor(yellow);
gotoxy(d,d1);
write(slowo);
delay(200);
textcolor(blue);
gotoxy(e,e1);
write(slowo);
delay(200);
textcolor(cyan);
gotoxy(f,f1);
write(slowo);
delay(200);
textcolor(lightblue);
gotoxy(g,g1);
write(slowo);
delay(200);
end;
readln;
end.