Dreamer Forums
« [Pascal] Variable issue »

Welcome Guest. Please Login or Register.
Dec 31, 2009, 4:02pm




Dreamer Forums :: Tech Support :: Graphic/Programming Support :: Programming Support :: [Pascal] Variable issue
   [Search This Thread][Send Topic To Friend] [Print]
 AuthorTopic: [Pascal] Variable issue (Read 166 times)
Zero
Administrator
*****
Made of Feathers and Cookies.
member is offline



Birds are AWESOME.

[msn] [aim]

Joined: Sept 2003
Gender: Male
Posts: 5,893
Location: Asgaard!
Karma: 17
 [Pascal] Variable issue
« Thread Started on Mar 4, 2006, 1:59pm »

alright, so I've been working on this program for a while, just a small game of sorts i'm trying to make, i'll probably never finish it but anyways. I have a variable issue, in my program I want to make like a secret part of it, where if you type in a specific word in the starting menu it will jump to a part of the program that wont run if you just play normally.

for my menu I use a case code, where the variable is set to be char, but that means I can't use more than 1character/number/symbol in the menu. So I need to mis the menu with another variable, but i'm not sure how to do so.

Code:
program <insert name>;
uses crt;
var a: char;

begin
writeln('hello :o');
readln(a);
case a of
'1': goto <label name>;
'2': goto <label2 name>;
'3': goto <label3 name>;
end;

end.

so in this menu I want to make it if you type "secret" it jumps to a different part of the program. I could change it all to IF codes, but it's easier to remove bugs so the program wont crash with the case menu.

any suggestions?
« Last Edit: Mar 14, 2006, 7:28am by Zero »Link to Post - Back to Top  IP: Logged

[image]
>: O steal my graphics and die!
Celestial Call and Dark Sphere layouts ©Zero
[image]
Lomion
The Elite
**
member is offline

[avatar]

Napom 2.0

[msn]

Joined: Jul 2006
Gender: Male
Posts: 39
Location: Δ Mac Anu
Karma: 1
 Re: [Pascal] Variable issue
« Reply #1 on Jul 13, 2006, 10:18pm »

Well, this is definitely late, but you should make the character variable into a string variable. A string will consist of a series of characters, like a word. Basically, change "char" to "string" and it should be good to go! But I haven't done Pascal for a couple years, so it may not be "string". I'm pretty darn sure it is, thought.
Link to Post - Back to Top  IP: Logged

[image]
Early to rise and early to bed, make a man healthy and socially dead.
Zero
Administrator
*****
Made of Feathers and Cookies.
member is offline



Birds are AWESOME.

[msn] [aim]

Joined: Sept 2003
Gender: Male
Posts: 5,893
Location: Asgaard!
Karma: 17
 Re: [Pascal] Variable issue
« Reply #2 on Aug 1, 2006, 4:13pm »

the problem by using a STRING is that it makes it alot harder to make the program error proof, so if I push the wrong key or number the program will shut down. Sorry my tiny preview didn't show this. I needed a combination of both.
Link to Post - Back to Top  IP: Logged

[image]
>: O steal my graphics and die!
Celestial Call and Dark Sphere layouts ©Zero
[image]
Zero
Administrator
*****
Made of Feathers and Cookies.
member is offline



Birds are AWESOME.

[msn] [aim]

Joined: Sept 2003
Gender: Male
Posts: 5,893
Location: Asgaard!
Karma: 17
 Re: [Pascal] Variable issue
« Reply #3 on Aug 28, 2007, 10:42pm »

God damn it this is an old topic Dx

CLOSED! DX for the love of God, CLOSED!
Link to Post - Back to Top  IP: Logged

[image]
>: O steal my graphics and die!
Celestial Call and Dark Sphere layouts ©Zero
[image]
   [Search This Thread][Send Topic To Friend] [Print]

Click Here To Make This Board Ad-Free


This Board Hosted For FREE By ProBoards
Get Your Own Free Message Boards & Free Forums!