program meet_code;
uses crt, dos;
label menu;
type
string40=string[40];
rd_array= array[1..10,1..4] of string[40];
rdn_array= array[1..5] of string[40];
horse_array= array[1..10,1..20,1..5] of string[40];
var
point_st: string[5];
n_si: single;
n_st: string[4];
nc_st: string[1];
nc1_st, nc2_st, nc3_st: string[1];
nc1_int, nc2_int, nc3_int, error_int: integer;
wt1_st, wt2_st, wt3_st: string[10];
spath: pathstr;
rd_p: ^rd_array;
rdn_p: ^rdn_array;
horse_p: ^horse_array;
ic_ch: char;
fname_ct,nrsff_ct,rsff_ct, mf_ct, rf_ct, hf_ct, nrf_ct, nhf_ct:
string[10];
mv_by: byte;
rvs_ct: string[40];
rr_by, nor_by: byte;
n_by,rsf_by, rsfsave_by, raceloop_by: byte;
lp4_by,lp_by, lp2_by, lp3_by :byte;
rta_by: byte;
mltag_bo,rsftag_bo, metag_bo, retag_bo: boolean;
hir_by:array[1..10] of byte;
h_cf30:string[50];
bytefile: file of byte;
string30file: file of string;
string30: string;
string30_2: string;
string30_3: string;
string30_4: string;
nscratch_by: byte;
rscratch_by, hscratch_by: array[1..18] of byte;
procedure pdeweightconvert(n_si: single);
begin
str(n_si:2:1,n_st);
nc1_st:=n_st[1];
nc2_st:=n_st[2];
nc3_st:=n_st[4];
val(nc1_st,nc1_int,error_int);
val(nc2_st,nc2_int,error_int);
val(nc3_st,nc3_int,error_int);
case nc1_int of
3: wt1_st:='thirty';
4: wt1_st:='forty';
5: wt1_st:='fifty';
6: wt1_st:='sixty';
7: wt1_st:='seventy';
end;
case nc2_int of
0: wt2_st:='';
1: wt2_st:='one';
2: wt2_st:='two';
3: wt2_st:='three';
4: wt2_st:='four';
5: wt2_st:='five';
6: wt2_st:='six';
7: wt2_st:='seven';
8: wt2_st:='eight';
9: wt2_st:='nine';
end;
case nc3_int of
0: wt3_st:='';
1: wt3_st:='one';
2: wt3_st:='two';
3: wt3_st:='three';
4: wt3_st:='four';
5: wt3_st:='five';
6: wt3_st:='six';
7: wt3_st:='seven';
8: wt3_st:='eight';
9: wt3_st:='nine';
end;
if (wt3_st='') then point_st:=''
else point_st:='p';
rvs_ct:=wt1_st+wt2_st+point_st+wt3_st;
end;
procedure pdedayconvert(n_by:byte);
begin
case n_by of
1: rvs_ct:='monday';
2: rvs_ct:='tuesday';
3: rvs_ct:='wednesday';
4: rvs_ct:='thursday';
5: rvs_ct:='friday';
6: rvs_ct:='saturday';
7: rvs_ct:='sunday';
end;
end;
procedure pdemonthconvert(n_by:byte);
begin
case n_by of
1: rvs_ct:='january';
2: rvs_ct:='february';
3: rvs_ct:='march';
4: rvs_ct:='april';
5: rvs_ct:='may';
6: rvs_ct:='june';
7: rvs_ct:='july';
8: rvs_ct:='august';
9: rvs_ct:='september';
10: rvs_ct:='october';
11: rvs_ct:='november';
12: rvs_ct:='december';
end;
end;
procedure pdenumconvert(n_by:byte);
begin
case n_by of
1: rvs_ct:='one';
2: rvs_ct:='two';
3: rvs_ct:='three';
4: rvs_ct:='four';
5: rvs_ct:='five';
6: rvs_ct:='six';
7: rvs_ct:='seven';
8: rvs_ct:='eight';
9: rvs_ct:='nine';
10: rvs_ct:='ten';
11: rvs_ct:='eleven';
12: rvs_ct:='twelve';
13: rvs_ct:='thirteen';
14: rvs_ct:='fourteen';
15: rvs_ct:='fifteen';
16: rvs_ct:='sixteen';
17: rvs_ct:='seventeen';
18: rvs_ct:='eighteen';
19: rvs_ct:='nineteen';
20: rvs_ct:='twenty';
21: rvs_ct:='twentyone';
22: rvs_ct:='twentytwo';
23: rvs_ct:='twentythree';
24: rvs_ct:='twentyfour';
25: rvs_ct:='twentyfive';
26: rvs_ct:='twentysix';
27: rvs_ct:='twentyseven';
28: rvs_ct:='twentyeight';
29: rvs_ct:='twentynine';
30: rvs_ct:='thirty';
31: rvs_ct:='thirtyone';
32: rvs_ct:='thirtytwo';
end;
end;
procedure meraceentry;
begin
clrscr;
write('data entry for race (', raceloop_by, ') (low caps., no
spaces, w-word, n-number)');
gotoxy(1,4);
write('time(w): ');
gotoxy(20,4);
readln(rd_p^[raceloop_by,1]);
pdenumconvert(raceloop_by);
rd_p^[raceloop_by,2]:=rvs_ct;
gotoxy(1,6);
write('race name(w): ');
gotoxy(20,6);
readln(rd_p^[raceloop_by,3]);
gotoxy(1,8);
write('race length(w): ');
gotoxy(20,8);
readln(rd_p^[raceloop_by,4]);
gotoxy(1,25);
write('input correct(y/n): ');
if (readkey=chr(110)) then meraceentry;
end;
procedure mehorseentry;
begin
clrscr;
write('data entry for horses in race (',raceloop_by,') (low caps.,
no spaces, w-word, n-number)');
gotoxy(1,2);
write('horses in race(n): ');
read(hir_by[raceloop_by]);
readln(rvs_ct);
for lp_by:=1 to hir_by[raceloop_by] do
begin
gotoxy(1,4+lp_by);
write('h','[', lp_by,'](w):');
gotoxy(10,4+lp_by);
readln(horse_p^[raceloop_by,lp_by,1]);
gotoxy(32,4+lp_by);
write('b(n):');
gotoxy(37,4+lp_by);
read(n_by);
pdenumconvert(n_by);
horse_p^[raceloop_by,lp_by,2]:=rvs_ct;
gotoxy(41,4+lp_by);
write('j(w):');
gotoxy(46,4+lp_by);
readln(rvs_ct);
readln(horse_p^[raceloop_by,lp_by,3]);
gotoxy(63,4+lp_by);
write('w(n):');
gotoxy(68,4+lp_by);
readln(n_si);
pdeweightconvert(n_si);
horse_p^[raceloop_by,lp_by,4]:=rvs_ct;
pdenumconvert(lp_by);
horse_p^[raceloop_by,lp_by,5]:=rvs_ct;
end;
gotoxy(1,25);
write('input correct(y/n): ');
read(ic_ch);
if (ic_ch=chr(110)) then mehorseentry;
end;
procedure memeetrecord;
begin
clrscr;
write('record meeting');
gotoxy(1,4);
write('file name for meeting(w): ');
readln(rvs_ct);
readln(fname_ct);
mf_ct:=fname_ct+'m';
rf_ct:=fname_ct+'r';
hf_ct:=fname_ct+'h';
nrf_ct:=fname_ct+'nr';
nhf_ct:=fname_ct+'nh';
assign(bytefile, nrf_ct);
rewrite(bytefile);
write(bytefile,nor_by);
close(bytefile);
assign(bytefile,nhf_ct);
rewrite(bytefile);
for lp_by:=1 to nor_by do
begin
write(bytefile,hir_by[lp_by]);
end;
close(bytefile);
assign(string30file, mf_ct);
rewrite(string30file);
for lp_by:=1 to 5 do
begin
string30:=rdn_p^[lp_by];
write(string30file,string30);
end;
close(string30file);
assign(string30file, rf_ct);
rewrite(string30file);
for lp_by:=1 to nor_by do
begin
for lp2_by:=1 to 4 do
begin
string30:=rd_p^[lp_by, lp2_by];
write(string30file,string30);
end;
end;
close(string30file);
assign(string30file,hf_ct);
rewrite(string30file);
for lp_by:=1 to nor_by do
begin
for lp2_by:=1 to hir_by[lp_by] do
begin
for lp3_by:=1 to 5 do
begin
string30:=horse_p^[lp_by, lp2_by, lp3_by];
write(string30file, string30);
end;
end;
end;
close(string30file);
end;
procedure initvars;
begin
for lp_by:=2 to 10 do
begin
end;
fname_ct:='';
rr_by:=0;
nor_by:=0;
n_by:=0;
rsf_by:=0;
rsfsave_by:=0;
rta_by:=0;
mltag_bo:=false;
rsftag_bo:=false;
metag_bo:=false;
retag_bo:=false;
for lp_by:=1 to 10 do
begin
hir_by[lp_by]:=0;
end;
for lp_by:=1 to 20 do
begin
rscratch_by[lp_by]:=0;
hscratch_by[lp_by]:=0;
end;
end;
procedure meetentry;
begin
initvars;
metag_bo:=true;
clrscr;
write('data entry for meeting (low caps., no spaces, w-word, n-
number)');
gotoxy(1,4);
write('number of races(n): ');
gotoxy(20,4);
read (nor_by);
gotoxy(1,6);
write('day(n): ');
gotoxy(20,6);
read(n_by);
pdedayconvert(n_by);
rdn_p^[1]:=rvs_ct;
gotoxy(1,8);
write('day date(n): ');
gotoxy(20,8);
read(n_by);
pdenumconvert(n_by);
rdn_p^[2]:=rvs_ct;
gotoxy(1,10);
write('month date(n): ');
gotoxy(20,10);
read(n_by);
pdenumconvert(n_by);
rdn_p^[3]:=rvs_ct;
pdemonthconvert(n_by);
rdn_p^[4]:=rvs_ct;
gotoxy(1,12);
write('location(w): ');
gotoxy(20,12);
readln(rvs_ct);
readln(rdn_p^[5]);
gotoxy(1,25);
write('input correct(y/n): ');
if (readkey=chr(110)) then meetentry;
for raceloop_by:=1 to nor_by do
begin
if(raceloop_by>1) then readln(rvs_ct);
meraceentry;
mehorseentry;
end;
memeetrecord;
end;
procedure scratchings;
label scratchagain;
begin
initvars;
metag_bo:=false;
retag_bo:=false;
clrscr;
write('screen for entering scratchings (max:18s)');
gotoxy(1,4);
write('file to retrieve(w):');
gotoxy(22,4);
readln(rvs_ct);
readln(fname_ct);
hf_ct:=fname_ct+'h';
nrf_ct:=fname_ct+'nr';
nhf_ct:=fname_ct+'nh';
assign(bytefile, nrf_ct);
reset(bytefile);
read(bytefile,nor_by);
close(bytefile);
assign(bytefile,nhf_ct);
reset(bytefile);
for lp_by:=1 to nor_by do
begin
read(bytefile,hir_by[lp_by]);
end;
close(bytefile);
assign(string30file,hf_ct);
reset(string30file);
for lp_by:=1 to nor_by do
begin
for lp2_by:=1 to hir_by[lp_by] do
begin
for lp3_by:=1 to 5 do
begin
read(string30file, string30);
horse_p^[lp_by, lp2_by, lp3_by]:=string30;
end;
end;
end;
close(string30file);
scratchagain:
clrscr;
write('screen for entering scratchings (max:18s)');
gotoxy(60,1);
write('file: ');
gotoxy(67,1);
write(fname_ct);
gotoxy(1,4);
write('number of scratchings(n):');
gotoxy(27,4);
read(nscratch_by);
if(nscratch_by>18) then goto scratchagain;
for lp_by:=1 to nscratch_by do
begin
gotoxy(1,6+lp_by);
write('scratching[',lp_by,'] race number(n):');
gotoxy(32,6+lp_by);
read(rscratch_by[lp_by]);
gotoxy(42,6+lp_by);
write('scratching[',lp_by,'] horse number(n):');
gotoxy(75,6+lp_by);
read(hscratch_by[lp_by]);
end;
gotoxy(1,25);
write('input correct(y/n): ');
readln(rvs_ct);
read(ic_ch);
if (ic_ch=chr(110)) then goto scratchagain;
for lp_by:=1 to nscratch_by do
begin
horse_p^[rscratch_by[lp_by],hscratch_by[lp_by],3]:='s';
end;
assign(string30file,hf_ct);
rewrite(string30file);
for lp_by:=1 to nor_by do
begin
for lp2_by:=1 to hir_by[lp_by] do
begin
for lp3_by:=1 to 5 do
begin
string30:=horse_p^[lp_by, lp2_by, lp3_by];
write(string30file, string30);
end;
end;
end;
close(string30file);
fname_ct:='';
end;
procedure initdynamicvars;
begin
getmem(rd_p,10*4*sizeof(string40));
getmem(rdn_p,5*sizeof(string40));
getmem(horse_p,10*20*5*sizeof(string40));
end;
procedure freedynamicvars;
begin
freemem(rd_p,10*4*sizeof(string40));
freemem(rdn_p,5*sizeof(string40));
freemem(horse_p,10*20*5*sizeof(string40));
end;
begin
initdynamicvars;
initvars;
menu:
textmode(co80);
clrscr;
write('main menu: enter option (max:10r-20h)');
gotoxy(1,4);
write('(1) enter & record meeting');
gotoxy(1,6);
write('(2) enter scratchings');
gotoxy(1,8);
write('(3) exit program');
gotoxy(1,12);
write('selection (n):');
gotoxy(16,12);
read(mv_by);
case mv_by of
1: meetentry;
2: scratchings;
3: begin
freedynamicvars;
exit;
end;
else
goto menu;
end;
goto menu;
end.


|