Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

If...then Reserve?

If...then Reserve?

If...then Reserve?

I am really new to Pascal I am a junior at Sprague High School and i am looking for some help?

I am writing this program to have the user Input there name and age and then the comput outputs if they can vote or not..


This is my procedure for outputting Vote Or not.
Procedure Output( Name : String; Age : Integer );


  If ( age < 18) {or (age = 18)} Then

     Write(' You Can Vote ' , Name , '! ')


  If (age > 18) or (age = 18) Then

     Write(' Sorry Cant Vote Yet...');


Now when i run it it works and i input a name..and an age..but when i input an age over 18 like say i do 24 it still says that i cant vote...I am sure its something simple but god its a mind boogler i am getting frustrated and this stuff is do tomorrow morning first period.

thanx alot :-\

RE: If...then Reserve?

Maybe the number you pass as age is wrong. Add the following line to the beginning of your procedure:
writeln('Your age is ',age);

Note also that the operators >= and <= exist (greater or equal and smaller or equal respectively).

In your else clause you don't have put an if again: the else clause can only be reached when age is greater or equal to 18, so you don't have to check on that again.

Bert Vingerhoets
Don't worry what people think about you. They're too busy wondering what you think about them.

RE: If...then Reserve?

You've got the ifs the wrong way round if you want it to write that you can vote only if 18 or over. The way you've written it, it will say you can vote if less than 18. Otherwise it's fine! (but Bert is right about everything he says, too!)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close