Hey Jayy,
All done, send me a mail as requested and I'll post you the code.
na
---- listing ----
program Demo2;
uses Crt;
var Ages: array[0..99] of integer; {define ages array}
Count: Integer; {used to count actual ages entered}
Done: boolean; {program done, true/false}
{ support functions and procedures }
function IntToStr(i: integer): string;
var res: string; {function result}
begin
{convert a string into an integer}
Str(i,res); {convert integer i into string res}
IntToStr:=res; {return function result}
end; {IntToStr}
function StrToInt(s: string): Integer;
var res,v,c: integer; {result, value, code}
begin
{convert an number into an integer}
res:=0; {default result}
if Length(s)>0 then {if length of s is greater than zero}
begin
Val(s,v,c); {convert string s into value v}
if c=0 then res:=v; {if success (code=0), then res=value v}
end; {if}
StrToInt:=res; {return function result}
end; {StrToInt}
function GetChoice(F,T: Char): integer;
var res: integer; {result}
Spk,Asc: integer; {spk=special key, asc=ascii key}
begin
{wait for, and return, a users 'key' choice}
res:=-1; {default result}
while (res=-1) do {loop while res=-1}
begin
Spk:=0; {default spk}
Asc:=Ord(UpCase(ReadKey)); {capture key}
if Asc=0 then {if asc=0}
begin
Spk:=1; {mark special key press,}
Asc:=Ord(UpCase(ReadKey)); {and then capture actual key}
end; {if}
if (Spk=0) and (Asc in [Ord(F)..Ord(T)]) then {if not spk, and asc in specified key range}
res:=Asc-Ord(F); {calculate result}
end; {while}
GetChoice:=res;
end; {GetChoice} {return function result}
{ main program functions and procedures }
procedure ClearAllData(Ask: boolean);
var i: integer; {i used for index in array}
begin
{Clear all data in the Ages array}
i:=1; {default i=1}
if Ask then {if ask user (confirm clear)}
begin
WriteLn; {new line}
Write('Are you sure you want to clear all data [1=Yes, 0=No]? '); {write some text}
i:=GetChoice('0','1'); {get the users choice}
end; {if}
if i=1 then {if i=1 then}
begin
for i:=Low(Ages) to High(Ages) do {loop from start to end of array}
Ages[i]:=0; {set Ages[i] = 0}
Count:=Low(Ages)-1; {finally, set count = low ages}
end; {if}
end; {ClearAllData}
procedure InputAges(Qty: integer);
var i: integer; {integer i, used for index}