Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 09-24-2003, 04:00 PM   #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.
holocube is offline   Reply With Quote
Old 09-27-2003, 07:51 PM   #2
aym
Registered User
 
aym's Avatar
 
Join Date: Nov 2001
Posts: 1,965
Code:
IF ',NAME,'='Tim' THEN
should be:
Code:
IF NAME = 'Tim' THEN
and you should place BEGIN after IF, not before it:
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;
The same applies to the rest of IF statements.
aym is offline   Reply With Quote
Old 09-28-2003, 03:54 PM   #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}
holocube is offline   Reply With Quote
Old 09-29-2003, 05:41 PM   #4
aym
Registered User
 
aym's Avatar
 
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';
HTH
aym is offline   Reply With Quote
Old 09-30-2003, 11:38 AM   #5
Member (8 bit)
 
Join Date: Oct 2002
Location: Earth
Posts: 128
k, thx =)
holocube is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 08:06 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2