Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4095
Number of posts: 14004

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
i keep gettin runtime error 2 in this code. HELP PLEASE Posted by peppy_jewel on 28 Feb 2005 at 9:24 AM
PROGRAM AutomaticCheckin(INPUT,OUTPUT);

uses WinDos, WinCrt;

CONST
MaxChar=20;

TYPE
TextString=PACKED ARRAY [0..MaxChar-1] OF CHAR;
StaffDetails= RECORD

Name:TextString;
Username:TextString;
Password:TextString;

END;
StaffFile= FILE OF StaffDetails;


VAR

password1: STRING;
password2: STRING;
U_name: STRING;
P_word: STRING;
Name: STRING;
Username: STRING;


StaffRecord: StaffDetails;
staff,temporary:staffFile;

choice1: CHAR;




{******************************************************************************}

PROCEDURE registration;
VAR
reply:CHAR;
found:BOOLEAN;
BEGIN

WRITELN('Regristration.');
WRITELN (' Input the following details inorder to register.');Writeln;
REPEAT
WITH StaffRecord DO
WRITELN('Enter your name:');
READLN (name);
WRITELN('Enter your username:');
READLN (username);
WRITELN('Enter your password:');
READLN (**********);
WRITELN('Please retype your password:');
READLN (**********);
WRITELN( 'This is your,staffRecord.');
WRITELN('repeat? Y(es) or N(o)');
READLN (reply);
UNTIL reply='N';
ASSIGN(staff,'c:staff');
{REWRITE(staff);}


RESET(staff);
RAED
WHILE NOT EOF(staff) OR Found = false DO
BEGIN
WITH staffrecord DO

BEGIN
Read(staff,staffrecord);
If username = username Then
FOUND := true;
WRITELN('Your registration was successful!');
END;
END;
WHILE EOF DO CLRSCR
END;

{******************************************************************************}
PROCEDURE TextInput (VAR item: TextString);
CONST
space=CHAR(32);
VAR
index: INTEGER;
BEGIN
FOR index:=0 TO MaxChar-1 DO
IF EOLN THEN
item [index]:= space
ELSE
Read (item[index]);
{end if}
{end for}
READLN;
END;{TextInput}





{**********************************************************************************}

PROCEDURE FieldInput (VAR staff:StaffFile);
VAR temporary:Stafffile;
CONST
No='N';
VAR
reply:CHAR;
BEGIN
Writeln('input the following details');Writeln;
WITH StaffRecord DO
BEGIN
REPEAT
WRITELN('BISHOPS HIGH SCHOOL TOBAGO.');
WRITELN('Automatic-Checkin ');
Write('name =>');TextInput(Name);
Write('username =>');TextInput(username);
Write('password =>');TextInput(password);
ASSIGN(staff,'C:staff');
ASSIGN(temporary,'c:temporary');
RESET(staff);
Rewrite(temporary);
WHILE NOT EOF (staff) DO
BEGIN
Read(staff, Staffrecord);
Write(temporary,StaffRecord)
END;
Write('continue?Y(es) or N(o)');Readln(reply);
UNTIL reply=No;
END;{with}
END;{FieldINput}

{************************************************************************************}




PROCEDURE mainscreen; }



BEGIN {mainscreen}
Gotoxy(28,1);
WRITELN('Welcome to BISHOPS HIGH SCHOOL.');

WRITELN('Are you registering for the first time? Y(es) or N(o)');
READLN (choice1);
IF Choice1 = 'Y' THEN
registration
ELSE IF choice1 = 'N' THEN
FieldInput ( staff);
WRITELN ('Goodbye,have a nice day.');
WHILE EOF DO CLRSCR
END.

{******************************************************************************* }



Report
Re: i keep gettin runtime error 2 in this code. HELP PLEASE Posted by zibadian on 28 Feb 2005 at 9:28 AM
: PROGRAM AutomaticCheckin(INPUT,OUTPUT);
:
: uses WinDos, WinCrt;
:
: CONST
: MaxChar=20;
:
: TYPE
: TextString=PACKED ARRAY [0..MaxChar-1] OF CHAR;
: StaffDetails= RECORD
:
: Name:TextString;
: Username:TextString;
: Password:TextString;
:
: END;
: StaffFile= FILE OF StaffDetails;
:
:
: VAR
:
: password1: STRING;
: password2: STRING;
: U_name: STRING;
: P_word: STRING;
: Name: STRING;
: Username: STRING;
:
:
: StaffRecord: StaffDetails;
: staff,temporary:staffFile;
:
: choice1: CHAR;
:
:
:
:
: {******************************************************************************}
:
: PROCEDURE registration;
: VAR
: reply:CHAR;
: found:BOOLEAN;
: BEGIN
:
: WRITELN('Regristration.');
: WRITELN (' Input the following details inorder to register.');Writeln;
: REPEAT
: WITH StaffRecord DO
: WRITELN('Enter your name:');
: READLN (name);
: WRITELN('Enter your username:');
: READLN (username);
: WRITELN('Enter your password:');
: READLN (**********);
: WRITELN('Please retype your password:');
: READLN (**********);
: WRITELN( 'This is your,staffRecord.');
: WRITELN('repeat? Y(es) or N(o)');
: READLN (reply);
: UNTIL reply='N';
: ASSIGN(staff,'c:staff');
: {REWRITE(staff);}
:
:
: RESET(staff);
: RAED
: WHILE NOT EOF(staff) OR Found = false DO
: BEGIN
: WITH staffrecord DO
:
: BEGIN
: Read(staff,staffrecord);
: If username = username Then
: FOUND := true;
: WRITELN('Your registration was successful!');
: END;
: END;
: WHILE EOF DO CLRSCR
: END;
:
: {******************************************************************************}
: PROCEDURE TextInput (VAR item: TextString);
: CONST
: space=CHAR(32);
: VAR
: index: INTEGER;
: BEGIN
: FOR index:=0 TO MaxChar-1 DO
: IF EOLN THEN
: item [index]:= space
: ELSE
: Read (item[index]);
: {end if}
: {end for}
: READLN;
: END;{TextInput}
:
:
:
:
:
: {**********************************************************************************}
:
: PROCEDURE FieldInput (VAR staff:StaffFile);
: VAR temporary:Stafffile;
: CONST
: No='N';
: VAR
: reply:CHAR;
: BEGIN
: Writeln('input the following details');Writeln;
: WITH StaffRecord DO
: BEGIN
: REPEAT
: WRITELN('BISHOPS HIGH SCHOOL TOBAGO.');
: WRITELN('Automatic-Checkin ');
: Write('name =>');TextInput(Name);
: Write('username =>');TextInput(username);
: Write('password =>');TextInput(password);
: ASSIGN(staff,'C:staff');
: ASSIGN(temporary,'c:temporary');
: RESET(staff);
: Rewrite(temporary);
: WHILE NOT EOF (staff) DO
: BEGIN
: Read(staff, Staffrecord);
: Write(temporary,StaffRecord)
: END;
: Write('continue?Y(es) or N(o)');Readln(reply);
: UNTIL reply=No;
: END;{with}
: END;{FieldINput}
:
: {************************************************************************************}
:
:
:
:
: PROCEDURE mainscreen; }
:
:
:
: BEGIN {mainscreen}
: Gotoxy(28,1);
: WRITELN('Welcome to BISHOPS HIGH SCHOOL.');
:
: WRITELN('Are you registering for the first time? Y(es) or N(o)');
: READLN (choice1);
: IF Choice1 = 'Y' THEN
: registration
: ELSE IF choice1 = 'N' THEN
: FieldInput ( staff);
: WRITELN ('Goodbye,have a nice day.');
: WHILE EOF DO CLRSCR
: END.
:
: {******************************************************************************* }
:
:
:
:
Run-time error 2 is a "File not found" error. This is called upon a Reset() or Append(), if the filename doesn't exist. Next time, please look up the error code in the help files.
Also there is at least 1 potentially terrible error in the code. I've marked it in red. This will create an infinite loop.
Report
Re: i keep gettin runtime error 2 in this code. HELP PLEASE Posted by Gaashius on 17 Mar 2005 at 3:53 AM
Hi.

You have not given a real filename at the ASSIGN procedure.
It should look like: ASSIGN(file,'c:\somethin.txt');
This is just an example, but if you want to open a file you need to give an existing file's name.

ASSIGN({filehandler},{filename});

I hope this helps you out.

GAASHIUS
Report
Re: i keep gettin runtime error 2 in this code. HELP PLEASE Posted by peppy_jewel on 17 Mar 2005 at 1:36 PM
Hello,
io have modified my code but however my search procedure is not working, hence i am gettin run time error 2. Could you help me please.

PROGRAM AutomaticCheckin(INPUT,OUTPUT);
USES WinDos, WinCrt;

CONST
MaxChar=20;

TYPE
TextString=PACKED ARRAY [0..MaxChar-1] OF CHAR;

dates = RECORD
day :word;
month :word;
year :word;
END;

times = RECORD
hrs:word;
min:word;
END;

StaffDetails= RECORD
Name :TextString;
Username :TextString;
Password :TextString;
time :times;
date :dates;

END;
StaffFile = FILE OF StaffDetails;


VAR

time : STRING;
Name : STRING;
Username : STRING;
TeachTime : times;
TeacherDate : dates;
y, m, d, dow : Word;

h, min, sec, hund : Word;

StaffRecord : StaffDetails;
staff,temporary : staffFile;

choice1 : CHAR;
reply : CHAR;
Found : boolean;
location : INTEGER;

FUNCTION LeadingZero(w : Word) : STRING;

VAR
s : STRING;

CONST
days : ARRAY [0..6] OF STRING[9] =
('Sunday','Monday','Tuesday',
'Wednesday','Thursday','Friday',
'Saturday');

BEGIN
Str(w:0,s);

IF Length(s) = 1 THEN
s := '0' + s;
LeadingZero := s;
END;


{*****************************************************************************************}
PROCEDURE dat(VAR y, m, d, dow : Word );

BEGIN
GetDate(y,m,d,dow);
Writeln('Today is ' ,
m:0, '/', d:0, '/', y:0);
GOTOXY(15,9);
WRITELN('Your sign in was successful!');
END;


{*****************************************************************************************}
PROCEDURE tim(VAR h:word;VAR min:word);

BEGIN


BEGIN
GetTime(h,min,sec,hund);
Writeln('It is now ',LeadingZero(h),':',
LeadingZero(min),':',LeadingZero(sec),
'.',LeadingZero(hund));
END;

END;






{**********************************************************************************************************}
PROCEDURE tell;


BEGIN

clrscr;

WRITELN('Enter Your name');
WRITELN('Enter your');
WRITELN('Enter you password');
WRITELN('Please re-type your password');


gotoxy(39,3);
READLN (name);

WRITELN;
gotoxy(43,5);
READLN (username);

WRITELN;
gotoxy(43,7);
READLN (**********);

WRITELN;
gotoxy(51,9);
READLN (**********);

WRITELN;

WRITELN;
gotoxy(53,14);
READLN (reply);
clrscr;

END;


{*******************************************************************************************}
PROCEDURE Search(Username:STRING;VAR found:Boolean;VAR location:INTEGER);
VAR index : INTEGER;

BEGIN
RESET(staff);
WHILE NOT EOF (staff) OR Found = true DO
BEGIN
RESET(staff);
index:=1;
IF Username = Username [index] THEN
BEGIN
Found:= True;
location := index
END
ELSE
IF Username<>Username[index] THEN
BEGIN
found:= false;
index:= index+1
END;
END;
IF found= true THEN
WRITELN('Your File was found!')
ELSE If found= false THEN
WRITELN('Your file was not found.Please try again!');
END;
{***************************************************************************************************}
PROCEDURE morningam (VAR TeachDate:dates; TeachTime:times);
BEGIN
IF h > 8 THEN
BEGIN

WRITELN('Why are you so late today?');
WRITELN;
WRITELN;
END


ELSE IF h < 8 THEN
BEGIN

WRITELN ('Congradulations you are early today!');
END
ELSE
CLRSCR;
END;
{*******************************************************************************************************************}
PROCEDURE Eveningpm (VAR TeachDate:dates; TeachTime:times);

BEGIN
IF h >1 THEN
BEGIN
WRITELN ('You are late!');
WRITELN;
END
ELSE IF h >1 THEN
BEGIN

WRITELN('Wonderful, you early this afternoon');
END
ELSE
CLRSCR;
END;


{*******************************************************************************************************************}
PROCEDURE registration(VAR staff:StaffFile; StaffRecord:StaffDetails; TeachDate:dates; TeachTime:times);


BEGIN


WRITELN('Regristration.');
WRITELN (' Input the following details inorder to register.');

WRITELN;

WITH StaffRecord DO
BEGIN
tell;

END;

IF
reply = 'Y' THEN

BEGIN
CLRSCR;
tell;
END



ELSE IF reply= 'y' THEN
BEGIN
CLRSCR;
tell;
END;


IF reply= 'N' THEN


BEGIN
WRITELN ('&**&*&*&*&**&*&*&*&*&*&&&*&*&*&&&*&*&*&*&*& ');
WRITELN ('This is your staffrecord * ');
WRITELN ('Your registration was successful at * ');

READLN;
Gotoxy(15,7);
tim(h,min);

BEGIN
Gotoxy(20,8);
dat( y, m, d, dow );
END;
END
ELSE IF reply='n'THEN
BEGIN
WRITELN ('&**&*&*&*&**&*&*&*&*&*&&&*&*&*&&&*&*&*&*&*& ');
WRITELN ('This is youstaffrecord');
WRITELN ('Yourregistration was successful ');

Gotoxy(15,7);

WRITELN;
tim(h,min);
WRITELN;
BEGIN
Gotoxy(20,8);
WRITELN;
dat( y, m, d, dow );;
END;
END ;
RESET(staff);

{END;}
END;
{******************************************************************************}
PROCEDURE TextInput (VAR item: TextString);
CONST
space=CHAR(32);
VAR
index: INTEGER;
BEGIN
FOR index:=0 TO MaxChar-1 DO
IF EOLN THEN
item [index]:= space
ELSE
Read (item[index]);

READLN;
END;





{**********************************************************************************}

PROCEDURE FieldInputa (VAR staff:StaffFile; StaffRecord:StaffDetails; TeachDate:dates; TeachTime:times);
CONST
No='N';
VAR temporary:Stafffile;
found:BOOLEAN;
reply:CHAR;
BEGIN
Gotoxy(28,1);
WRITELN('input the following details');
Gotoxy(28,3);
WRITELN;
WITH StaffRecord DO
BEGIN
CLRSCR;
WRITELN('&**&&**&&**&&**&&*&&** ');
WRITELN('BISHOPS High School');
WRITELN('Automatic Checkin');& ');
WRITELN(' name=> ');
WRITELN('username=>');
WRITELN('password=>');
gotoxy(33,7);
Write;TextInput(Name);
gotoxy(38,9);
Write;TextInput(username);
gotoxy(38,11);
Write; TextInput(password);
{ search(Username,found,location); }
END;
CLRSCR;
END;
{*************************************************************************}


PROCEDURE FieldInputb (VAR staff:StaffFile; StaffRecord:StaffDetails; TeachDate:dates; TeachTime:times);
VAR temporary:Stafffile;
VAR y, m, d, dow : Word ;
found:BOOLEAN;
letter:INTEGER;
CONST
No='N';


BEGIN
REPEAT
FieldInputa ( staff ,StaffRecord, TeachDate, TeachTime);
CLRSCR;
WRITELN('*/*/*/*////*/*/*/*//*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/');
WRITELN('* *');
WRITE ('* Did you make an error?Would you like to re-enter your data?Y(es) or N(o) *');
Gotoxy(33,5);
READLN(reply);
IF reply = 'y' THEN
FieldInputa(staff, StaffRecord, TeachDate,TeachTime)
ELSE IF
reply= 'Y' THEN
FieldInputa(staff, StaffRecord, TeachDate, TeachTime)

ELSE IF reply = 'N' THEN
WRITE('/*/*/*/*/*/Your sign in was successful!/*/*/*/*/*');
WRITELN;
WRITELN;
BEGIN
GetDate(y,m,d,dow);
Writeln('Today is ' ,
m:0, '/', d:0, '/', y:0);

END;
BEGIN
GetTime(h,min,sec,hund);
Writeln('It is now ',LeadingZero(h),':',
LeadingZero(min),':',LeadingZero(sec),
'.',LeadingZero(hund));

END;

REPEAT

WRITELN;
WRITELN('If it is morning, enter 1 or if it is afternoon enter 2');
READLN(letter);
If letter = 1 THEN
morningam( TeachDate, TeachTime)

ELSE IF letter = 2 THEN
BEGIN

WRITELN;
eveningpm( TeachDate, TeachTime);
WRITELN('Press Enter');
END
ELSE
WRITELN('ERROR');
READLN;
UNTIL letter < 3;
UNTIL reply= 'N';



END;

{******************************************************************************************}






BEGIN {mainscreen}
ASSIGN(staff,'a:staff');
ASSIGN(temporary,'a:temporary');
Gotoxy(28,1);

{ //| ,|
//,/ -~ |
// / | _-~ / ,
/'/ / / _-~ _/_-~ |
( ( / /' _ -~ _-~ ,/'
\~\/'/| __--~~__--\ _-~ _/,
,,)))))));, \/~-_ __--~~ --~~ __/~ _-~ /
__))))))))))))));,>/\ / __--~~ \-~~ _-~
-\(((((''''(((((((( >~\/ --~~ __--~' _-~ ~|
--==//////(('' . `)))))), / ___---~~ ~~\~~__--~
))| @ ;-. (((((/ __--~~~'~~/
( `| / ) )))/ ~~~~~__\__---~~__--~~--_
| | | (/ ---~~~/__-----~~ ,;::' \ ,
o_); ; / ----~~/ \,-~~~\ | /|
; ( ---~~/ `:::| |;| < >
| _ `----~~~~' / `:| \;\_____//
______/\/~ | / / ~------~
/~;;.____/;;' / ___----( `;;;/
/ // _;______;'------~~~~~ |;;/\ /
// | | / | \;;,\
(<_ | ; /',/-----' _>
\_| ||_ //~;~~~~~~~~~
`\_| (,~~
\~\
~~ }

WRITELN('Welcome to BISHOPS HIGH SCHOOL.');

WRITELN('Are you registering for the first time? Y(es) or N(o)');
READLN (choice1);
IF Choice1 = 'Y' THEN
registration(staff, StaffRecord, TeacherDate, TeachTime)
ELSE IF Choice1= 'y' THEN
registration (staff, StaffRecord,TeacherDate, TeachTime)
ELSE IF choice1 = 'N' THEN
BEGIN
FieldInputb ( staff,StaffRecord,TeacherDate,TeachTime);
WRITELN ('Goodbye,have a nice day.');

DONEWINCRT;
END
ELSE IF choice1='n' THEN
FieldInputb ( staff,StaffRecord,TeacherDate,TeachTime);
WRITELN ('Goodbye,have a nice day.');


DONEWINCRT;


END.





Report
Re: i keep gettin runtime error 2 in this code. HELP PLEASE Posted by peppy_jewel on 17 Mar 2005 at 1:37 PM
Hello,
io have modified my code but however my search procedure is not working, hence i am gettin run time error 2. Could you help me please.

PROGRAM AutomaticCheckin(INPUT,OUTPUT);
USES WinDos, WinCrt;

CONST
MaxChar=20;

TYPE
TextString=PACKED ARRAY [0..MaxChar-1] OF CHAR;

dates = RECORD
day :word;
month :word;
year :word;
END;

times = RECORD
hrs:word;
min:word;
END;

StaffDetails= RECORD
Name :TextString;
Username :TextString;
Password :TextString;
time :times;
date :dates;

END;
StaffFile = FILE OF StaffDetails;


VAR

time : STRING;
Name : STRING;
Username : STRING;
TeachTime : times;
TeacherDate : dates;
y, m, d, dow : Word;

h, min, sec, hund : Word;

StaffRecord : StaffDetails;
staff,temporary : staffFile;

choice1 : CHAR;
reply : CHAR;
Found : boolean;
location : INTEGER;

FUNCTION LeadingZero(w : Word) : STRING;

VAR
s : STRING;

CONST
days : ARRAY [0..6] OF STRING[9] =
('Sunday','Monday','Tuesday',
'Wednesday','Thursday','Friday',
'Saturday');

BEGIN
Str(w:0,s);

IF Length(s) = 1 THEN
s := '0' + s;
LeadingZero := s;
END;


{*****************************************************************************************}
PROCEDURE dat(VAR y, m, d, dow : Word );

BEGIN
GetDate(y,m,d,dow);
Writeln('Today is ' ,
m:0, '/', d:0, '/', y:0);
GOTOXY(15,9);
WRITELN('Your sign in was successful!');
END;


{*****************************************************************************************}
PROCEDURE tim(VAR h:word;VAR min:word);

BEGIN


BEGIN
GetTime(h,min,sec,hund);
Writeln('It is now ',LeadingZero(h),':',
LeadingZero(min),':',LeadingZero(sec),
'.',LeadingZero(hund));
END;

END;






{**********************************************************************************************************}
PROCEDURE tell;


BEGIN

clrscr;

WRITELN('Enter Your name');
WRITELN('Enter your');
WRITELN('Enter you password');
WRITELN('Please re-type your password');


gotoxy(39,3);
READLN (name);

WRITELN;
gotoxy(43,5);
READLN (username);

WRITELN;
gotoxy(43,7);
READLN (**********);

WRITELN;
gotoxy(51,9);
READLN (**********);

WRITELN;

WRITELN;
gotoxy(53,14);
READLN (reply);
clrscr;

END;


{*******************************************************************************************}
PROCEDURE Search(Username:STRING;VAR found:Boolean;VAR location:INTEGER);
VAR index : INTEGER;

BEGIN
RESET(staff);
WHILE NOT EOF (staff) OR Found = true DO
BEGIN
RESET(staff);
index:=1;
IF Username = Username [index] THEN
BEGIN
Found:= True;
location := index
END
ELSE
IF Username<>Username[index] THEN
BEGIN
found:= false;
index:= index+1
END;
END;
IF found= true THEN
WRITELN('Your File was found!')
ELSE If found= false THEN
WRITELN('Your file was not found.Please try again!');
END;
{***************************************************************************************************}
PROCEDURE morningam (VAR TeachDate:dates; TeachTime:times);
BEGIN
IF h > 8 THEN
BEGIN

WRITELN('Why are you so late today?');
WRITELN;
WRITELN;
END


ELSE IF h < 8 THEN
BEGIN

WRITELN ('Congradulations you are early today!');
END
ELSE
CLRSCR;
END;
{*******************************************************************************************************************}
PROCEDURE Eveningpm (VAR TeachDate:dates; TeachTime:times);

BEGIN
IF h >1 THEN
BEGIN
WRITELN ('You are late!');
WRITELN;
END
ELSE IF h >1 THEN
BEGIN

WRITELN('Wonderful, you early this afternoon');
END
ELSE
CLRSCR;
END;


{*******************************************************************************************************************}
PROCEDURE registration(VAR staff:StaffFile; StaffRecord:StaffDetails; TeachDate:dates; TeachTime:times);


BEGIN


WRITELN('Regristration.');
WRITELN (' Input the following details inorder to register.');

WRITELN;

WITH StaffRecord DO
BEGIN
tell;

END;

IF
reply = 'Y' THEN

BEGIN
CLRSCR;
tell;
END



ELSE IF reply= 'y' THEN
BEGIN
CLRSCR;
tell;
END;


IF reply= 'N' THEN


BEGIN
WRITELN ('&**&*&*&*&**&*&*&*&*&*&&&*&*&*&&&*&*&*&*&*& ');
WRITELN ('This is your staffrecord * ');
WRITELN ('Your registration was successful at * ');

READLN;
Gotoxy(15,7);
tim(h,min);

BEGIN
Gotoxy(20,8);
dat( y, m, d, dow );
END;
END
ELSE IF reply='n'THEN
BEGIN
WRITELN ('&**&*&*&*&**&*&*&*&*&*&&&*&*&*&&&*&*&*&*&*& ');
WRITELN ('This is youstaffrecord');
WRITELN ('Yourregistration was successful ');

Gotoxy(15,7);

WRITELN;
tim(h,min);
WRITELN;
BEGIN
Gotoxy(20,8);
WRITELN;
dat( y, m, d, dow );;
END;
END ;
RESET(staff);

{END;}
END;
{******************************************************************************}
PROCEDURE TextInput (VAR item: TextString);
CONST
space=CHAR(32);
VAR
index: INTEGER;
BEGIN
FOR index:=0 TO MaxChar-1 DO
IF EOLN THEN
item [index]:= space
ELSE
Read (item[index]);

READLN;
END;





{**********************************************************************************}

PROCEDURE FieldInputa (VAR staff:StaffFile; StaffRecord:StaffDetails; TeachDate:dates; TeachTime:times);
CONST
No='N';
VAR temporary:Stafffile;
found:BOOLEAN;
reply:CHAR;
BEGIN
Gotoxy(28,1);
WRITELN('input the following details');
Gotoxy(28,3);
WRITELN;
WITH StaffRecord DO
BEGIN
CLRSCR;
WRITELN('&**&&**&&**&&**&&*&&** ');
WRITELN('BISHOPS High School');
WRITELN('Automatic Checkin');& ');
WRITELN(' name=> ');
WRITELN('username=>');
WRITELN('password=>');
gotoxy(33,7);
Write;TextInput(Name);
gotoxy(38,9);
Write;TextInput(username);
gotoxy(38,11);
Write; TextInput(password);
{ search(Username,found,location); }
END;
CLRSCR;
END;
{*************************************************************************}


PROCEDURE FieldInputb (VAR staff:StaffFile; StaffRecord:StaffDetails; TeachDate:dates; TeachTime:times);
VAR temporary:Stafffile;
VAR y, m, d, dow : Word ;
found:BOOLEAN;
letter:INTEGER;
CONST
No='N';


BEGIN
REPEAT
FieldInputa ( staff ,StaffRecord, TeachDate, TeachTime);
CLRSCR;
WRITELN('*/*/*/*////*/*/*/*//*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/');
WRITELN('* *');
WRITE ('* Did you make an error?Would you like to re-enter your data?Y(es) or N(o) *');
Gotoxy(33,5);
READLN(reply);
IF reply = 'y' THEN
FieldInputa(staff, StaffRecord, TeachDate,TeachTime)
ELSE IF
reply= 'Y' THEN
FieldInputa(staff, StaffRecord, TeachDate, TeachTime)

ELSE IF reply = 'N' THEN
WRITE('/*/*/*/*/*/Your sign in was successful!/*/*/*/*/*');
WRITELN;
WRITELN;
BEGIN
GetDate(y,m,d,dow);
Writeln('Today is ' ,
m:0, '/', d:0, '/', y:0);

END;
BEGIN
GetTime(h,min,sec,hund);
Writeln('It is now ',LeadingZero(h),':',
LeadingZero(min),':',LeadingZero(sec),
'.',LeadingZero(hund));

END;

REPEAT

WRITELN;
WRITELN('If it is morning, enter 1 or if it is afternoon enter 2');
READLN(letter);
If letter = 1 THEN
morningam( TeachDate, TeachTime)

ELSE IF letter = 2 THEN
BEGIN

WRITELN;
eveningpm( TeachDate, TeachTime);
WRITELN('Press Enter');
END
ELSE
WRITELN('ERROR');
READLN;
UNTIL letter < 3;
UNTIL reply= 'N';



END;

{******************************************************************************************}






BEGIN {mainscreen}
ASSIGN(staff,'a:staff');
ASSIGN(temporary,'a:temporary');
Gotoxy(28,1);

{ //| ,|
//,/ -~ |
// / | _-~ / ,
/'/ / / _-~ _/_-~ |
( ( / /' _ -~ _-~ ,/'
\~\/'/| __--~~__--\ _-~ _/,
,,)))))));, \/~-_ __--~~ --~~ __/~ _-~ /
__))))))))))))));,>/\ / __--~~ \-~~ _-~
-\(((((''''(((((((( >~\/ --~~ __--~' _-~ ~|
--==//////(('' . `)))))), / ___---~~ ~~\~~__--~
))| @ ;-. (((((/ __--~~~'~~/
( `| / ) )))/ ~~~~~__\__---~~__--~~--_
| | | (/ ---~~~/__-----~~ ,;::' \ ,
o_); ; / ----~~/ \,-~~~\ | /|
; ( ---~~/ `:::| |;| < >
| _ `----~~~~' / `:| \;\_____//
______/\/~ | / / ~------~
/~;;.____/;;' / ___----( `;;;/
/ // _;______;'------~~~~~ |;;/\ /
// | | / | \;;,\
(<_ | ; /',/-----' _>
\_| ||_ //~;~~~~~~~~~
`\_| (,~~
\~\
~~ }

WRITELN('Welcome to BISHOPS HIGH SCHOOL.');

WRITELN('Are you registering for the first time? Y(es) or N(o)');
READLN (choice1);
IF Choice1 = 'Y' THEN
registration(staff, StaffRecord, TeacherDate, TeachTime)
ELSE IF Choice1= 'y' THEN
registration (staff, StaffRecord,TeacherDate, TeachTime)
ELSE IF choice1 = 'N' THEN
BEGIN
FieldInputb ( staff,StaffRecord,TeacherDate,TeachTime);
WRITELN ('Goodbye,have a nice day.');

DONEWINCRT;
END
ELSE IF choice1='n' THEN
FieldInputb ( staff,StaffRecord,TeacherDate,TeachTime);
WRITELN ('Goodbye,have a nice day.');


DONEWINCRT;


END.





Report
Re: i keep gettin runtime error 2 in this code. HELP PLEASE Posted by peppy_jewel on 23 Mar 2005 at 1:56 PM
:thank you for your help!




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.