Jump to content
Sign in to follow this  
Profth3tic

[PASCAL]BASKETBOLA SPĒLES PROTOKOLS

Recommended Posts

Vēl viens darbs no 1.kursa RTK! Nezinu vai jums būs ,ja mācāties ,bet drošībai jums iedošu!

Galvenais uzdevums: Izveidot basketbola spēles protokolu ar 10 spēlētājiem ,kuriem var pievienot iemestos punktus un soda punktus. Ar informācijas saglabāšanu failā.

Mani plusi un mīnusi darbā:

Plusi:

·         Īsa programma (77 rindiņas)

·         Var noteikt spēles beigu rezultātu.

·         Norādes iekavās.

Mīnusi:

·         Nevar ievadīt komandas nosaukumu

·         Ievadot spēlētājus var sajaukt abas komandas vietām.

·         Ievadot punktus rindiņas sākt “deformēties”

·         Pieskaita ,gan soda ,gan iemestos punktus ,kā kopējos punktus.

Programmas kods

Program basketbols;
uses crt;
label points,shtraf,endg,beigas,gal,save;
var
a:array[1..10] of string;
p:array[1..10] of integer;
s:array[1..10] of integer;
n,b,y,x,m:integer;
f:text;
Procedure team;
begin
clrscr;
TextColor(5);WriteLn('Komanda Nr.1:');
TextColor(2);WriteLn('Numurs','      ',  'Iemestie punkti',' ','  Soda punkti');
TextColor(15);
for n:=1 to 5 do WriteLn(a[n],' [',n,']','               ',p[n],'                ',s[n]);
WriteLn;
TextColor(3);WriteLn('Komanda Nr.2:');
TextColor(6);WriteLn('Numurs','      ',  'Iemestie punkti',' ','  Soda punkti');
TextColor(15);
for n:=6 to 9 do WriteLn(a[n],' [',n,']','               ',p[n],'                ',s[n]);
WriteLn(a[10],' [',10,']','              ',p[10],'                ',s[10]);
WriteLn;
WriteLn('Uzspied ENTER ,lai paraditu tabulas izvelni');
ReadLn;
End;
Begin
for n:=1 to 10 do begin
ClrScr;
WriteLn('Ievadiet',' ',n,'.','speletaja numuru:');
ReadLn(a[n]);
end;
gal:team;
WriteLn('Pievienot punktus(1)');
WriteLn('Pieskaitit soda punktus(2)');
WriteLn('Saskaitit punktus(3)');
WriteLn('Apstadinat programmu(4)');
WriteLn('Saglabat informaciju(5)');
write('Darbibas numurs:');ReadLn(;
case b of
1:goto points;
2:goto shtraf;
3:goto endg;
4:goto beigas;
5:goto save;
End;
points:Write('Izvelies kam pievienot punktus(speletaja kartas numurs): ');ReadLn(;
write('Cik punktus pievienot?: ');ReadLn(y);
p[b]:=p[b]+y;
goto gal;
shtraf:Write('Izvelies kam pievienot soda punktus(speletaja kartas numurs):');ReadLn(;
write('Cik soda punktus pievienot?: ');ReadLn(y);
s[b]:=s[b]+y;
goto gal;
endg:WriteLn('Visu punktu summa: ');
write('Komanda Nr. 1   -	');
for n:=1 to 5 do
x:=x+p[n]+s[n];
WriteLn(x);
write('Komanda Nr. 2   -	');
for n:=6 to 10 do
m:=m+p[n]+s[n];
WriteLn(m);
ReadLn;
goto gal;
save:assign(f,'H:\prakse_pascal\basket.txt');
rewrite(f);
WriteLn(f,'Komanda Nr.1:');
WriteLn(f,'Numurs',' ','Iemestie punktus',' ','  soda punktus');
for n:=1 to 5 do WriteLn(f,a[n],' [',n,']','      ',p[n],'       ',s[n]);
WriteLn(f,'Komanda Nr.2:');
for n:=6 to 9 do WriteLn(f,a[n],' [',n,']','      ',p[n],'       ',s[n]);
WriteLn(f,a[10],' [',10,']','     ',p[10],'       ',s[10]);
close(f);
ReadLn;
goto gal;
beigas:End.

PROGRAMMAS LEJUPIELĀDE - http://goo.gl/DYmcTb

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.