|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (8 bit)
Join Date: Oct 2002
Location: Earth
Posts: 128
|
Pascal source problem
can any1 tell me what ive written wrong in this source?
PROGRAM hehe; VAR NAME : String; BEGIN WRITE('Enter your name please: '); READLN(NAME); BEGIN IF ',NAME,'='Tim' THEN WRITELN('Why good evening sire, may i be the first to say how Incredibly dashing you do look tonight'); READLN; END; BEGIN IF ',NAME,'='Seb' then WRITELN('Do make yourself at home bro, the dorritos are over there --->'); READLN; END; BEGIN IF ',NAME,'='Fliss' then WRITELN('I am afraid you are not permitted, please leave now or you will be legally terminated'); READLN; END; END. |
|
|
|
|
|
#2 |
|
Registered User
Join Date: Nov 2001
Posts: 1,965
|
Code:
IF ',NAME,'='Tim' THEN Code:
IF NAME = 'Tim' THEN Code:
WRITE('Enter your name please: ');
READLN(NAME);
IF NAME = 'Tim' THEN
BEGIN
WRITELN('Why good evening sire, may i be the first to say how Incredibly dashing you do look tonight');
READLN;
END;
|
|
|
|
|
|
#3 |
|
Member (8 bit)
Join Date: Oct 2002
Location: Earth
Posts: 128
|
thx bro, 1 more thing, do u know how to tell it to repeat the program over and over and tell it to end the program when u type 'end' as the name? because i always get an abrupt end with this:
PROGRAM hehe; VAR NAME : String; BEGIN {main} BEGIN {1} WRITE('Enter your name please (enter "end" to exit): '); READLN(NAME); WRITELN; IF (NAME='Tim')OR(NAME='tim')OR(NAME='TIM') THEN BEGIN WRITELN('Why good evening sire, may i be the first to say how Incredibly dashing you do look tonight,'); WRITELN('I will send for your usual helping of hot girls immediately milord'); WRITELN; WRITELN('PRESS ENTER'); READLN; WRITELN; END; IF (NAME='seb')OR(NAME='Seb')OR(NAME='SEB')OR(NAME='woody')OR(NAME='Woody')OR(NAME='WOODY') OR(NAME='dave')OR(NAME='Dave')OR(NAME='DAVE') THEN BEGIN WRITELN('Do make yourself at home bro, the dorritos are over there --->'); WRITELN; WRITELN('PRESS ENTER'); READLN; WRITELN; END; IF (NAME='fliss')OR(NAME='Fliss')OR(NAME='FLISS') THEN BEGIN WRITELN('I am afraid you are not permitted, please leave now or you will be legally terminated,'); WRITELN('under law section 937.732 of the criminal 2250 criminal code'); WRITELN; WRITELN('PRESS ENTER'); READLN; WRITELN; END; IF (NAME='end')OR(NAME='End')OR(NAME='END') THEN BEGIN END {main}; END; END {1}. READLN; REPEAT {1} |
|
|
|
|
|
#4 |
|
Registered User
Join Date: Nov 2001
Posts: 1,965
|
one way to do it is to use a repeat/until loop, something like this:
Code:
repeat
{ code goes here }
until name = 'end';
|
|
|
|
|
|
#5 |
|
Member (8 bit)
Join Date: Oct 2002
Location: Earth
Posts: 128
|
k, thx =)
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|