Associate
- Joined
- 11 Nov 2006
- Posts
- 549
- Location
- Devon
Ok i have an assigment using pascal!
The outline of the assignment is
You are to take the role of a secretary whose society requires a method of keeping their monthly/annual statistics on disc in a bespoke program format.
I have done a basic program in pascal which is below.
program TCSP;
Uses Crt;
VAR MemberFile:Text;
Count:INTEGER;
Name:String;
PROCEDURE NamesIn;
BEGIN
Rewrite (MemberFile);
FOR Count:=1 TO 20 DO
BEGIN
ClrScr;
WriteLn('Please enter member name',Count);
ReadLn(Name);
WriteLn(MemberFile,'Member',Count,'is:',name);
END;
Close(MemberFile);
ClrScr;
WriteLn('Member File Created.. press key to end.');
ReadKey;
END;
PROCEDURE ShowNames;
BEGIN
Reset(MemberFile);
WHILE NOT Eof(MemberFile)DO
BEGIN
ReadLn(MemberFile, Name);
WriteLn(Name);
END
WriteLn('Member File Listed..press key to end.');
ReadKey;
END;
BEGIN
Assign(MemberFile,'c:\FileName');
NAmesIn;
ShowNames;
end.
After entering the member name at the very beginning i want the program to ask if new details are to be entered or to look for an old member. I am unsure of how to do this and the code needed to actually look into the memberfile and locate the name.
Any help with this or some polishing up of the current program would be greatly appreciated!
Thanks in advance
The outline of the assignment is
You are to take the role of a secretary whose society requires a method of keeping their monthly/annual statistics on disc in a bespoke program format.
I have done a basic program in pascal which is below.
program TCSP;
Uses Crt;
VAR MemberFile:Text;
Count:INTEGER;
Name:String;
PROCEDURE NamesIn;
BEGIN
Rewrite (MemberFile);
FOR Count:=1 TO 20 DO
BEGIN
ClrScr;
WriteLn('Please enter member name',Count);
ReadLn(Name);
WriteLn(MemberFile,'Member',Count,'is:',name);
END;
Close(MemberFile);
ClrScr;
WriteLn('Member File Created.. press key to end.');
ReadKey;
END;
PROCEDURE ShowNames;
BEGIN
Reset(MemberFile);
WHILE NOT Eof(MemberFile)DO
BEGIN
ReadLn(MemberFile, Name);
WriteLn(Name);
END
WriteLn('Member File Listed..press key to end.');
ReadKey;
END;
BEGIN
Assign(MemberFile,'c:\FileName');
NAmesIn;
ShowNames;
end.
After entering the member name at the very beginning i want the program to ask if new details are to be entered or to look for an old member. I am unsure of how to do this and the code needed to actually look into the memberfile and locate the name.
Any help with this or some polishing up of the current program would be greatly appreciated!
Thanks in advance