View Single Post
Old 03-02-2002, 05:20 PM  
ldinternet
Confirmed User
 
Join Date: Apr 2001
Posts: 8,245
You should remember at least a little. ;)

Done all the simple shit, so heres what I got so far... options 1 through 4 aren't working yet ;)

program cinema_pas;

uses wincrt;

var
continue:string;
clear:integer;
menuoption:char;
notation:string;
notefile:text;
username:string[10];
password:array[1..10] of char;
login:array[1..20] of string;
pass:array[1..20] of string;
protect:char;
user:string;
pw:string;
i:integer; {for controlling variable}
num:integer; {another controlling variable}
x:integer;
y:integer; {x and y coordinates}
halter:integer;


begin

clear:=clear+1;

if clear=1 then begin
assign(notefile,'c:\notes.txt');
rewrite(notefile);
close(notefile);
end;


{ PART ONE BEGIN }

clrscr;

gotoxy(5,2);
write('Welcome to the Cinema Ticket System');

gotoxy(5,4);
write('You will be asked for a username and password');
gotoxy(5,5);
write('Press any key to continue');
gotoxy(30,5);
readkey;

{PART ONE END }

login[1]:='staffone';
login[2]:='stafftwo';
protect:='*';

repeat
pw:=('');

repeat

halter:=halter+1;

clrscr;
gotoxy(5,2);
write('Please enter your password then press ENTER');
gotoxy(5,4);
write('Username: ');
readln(username);
gotoxy(5,5);
write('Password: ');

if halter=5 then
begin
gotoxy(5,5);
writeln('Too many incorrect attempts... program closing');
halt;
end;

until (username=login[1]) or (username=login[2]);
y:=15;
num:=5;

for i:=1 to num do
begin
password[i]:=readkey;
gotoxy(y,5);
write (protect);
y:=y+1;
end;

i:=1;

for i:=1 to num do
begin
pw:=pw+password[i];
end;
pass[1]:='somet'; pass[2]:='tsome';;

until
(username=login[1]) and (pw=pass[1]) or
(username=login[2]) and (pw=pass[2]);

begin
readkey;
gotoxy(5,7);
write('You are now logged in');
gotoxy(5,8);
write('Press any ENTER to continue');
readln;
end;

repeat

{PART TWO BEGIN}

clrscr;

gotoxy(5,2);
write('Main menu screen');

gotoxy(5,3);
write('Logged in as user: ',user);

gotoxy(5,5);
write('Customer related');
gotoxy(5,6);
write('1. Reserve a seat');
gotoxy(5,7);
write('2. Cancel a reservation');
gotoxy(5,8);
write('3. Display current seating plan');
gotoxy(5,9);
write('4. Write seating plan to file');

gotoxy(5,11);
write('Non customer related');
gotoxy(5,12);
write('A. Make notation');
gotoxy(5,13);
write('B. Retreive notation');

{PART TWO END}

gotoxy(5,15);
write('Please select an option (1-4 or A-B): ');
readln(menuoption);

if (menuoption='A') or (menuoption='a') then begin
clrscr;

gotoxy(5,2);
write('You chose: Non customer related');
gotoxy(5,3);
write('Option: A, Make notation');

gotoxy(5,5);
writeln('Make notes below, press ENTER to save to file:');
gotoxy(5,7);
assign(notefile,'c:\notes.txt');
rewrite(notefile);
read(notation);

writeln(notefile,notation);
close(notefile);

clrscr;

gotoxy(5,2);
write('Input has been saved.');
gotoxy(5,4);
write('You will be returned to the main menu');
gotoxy(5,5);
write('Press any key to continue');
readkey;

end;

if (menuoption='B') or (menuoption='b') then begin
clrscr;

assign(notefile,'c:\notes.txt');
reset(notefile);
readln(notefile,notation);
write(notation);
close(notefile);

if notation='' then
begin
gotoxy(5,2);
write('The note file is empty');
end;

gotoxy(5,4);
write('Press any key to continue');
readkey;
end;

begin

clrscr;

gotoxy(5,2);
write('Return to main menu or exit the program?');
gotoxy(5,3);
write('Press any key to continue or type EXIT');
gotoxy(5,4);
write('(case sensitive) to exit the program');
gotoxy(8,6);
write('WARNING: All data will be lost on exit!');
gotoxy(5,8);
readln(continue);

end;

until continue='EXIT';

end.
ldinternet is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote