If...then Reserve?
If...then Reserve?
(OP)
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..
BUT
This is my procedure for outputting Vote Or not.
Procedure Output( Name : String; Age : Integer );
Begin
If ( age < 18) {or (age = 18)} Then
Write(' You Can Vote ' , Name , '! ')
else
If (age > 18) or (age = 18) Then
Write(' Sorry Cant Vote Yet...');
end;
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 :-\
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..
BUT
This is my procedure for outputting Vote Or not.
Procedure Output( Name : String; Age : Integer );
Begin
If ( age < 18) {or (age = 18)} Then
Write(' You Can Vote ' , Name , '! ')
else
If (age > 18) or (age = 18) Then
Write(' Sorry Cant Vote Yet...');
end;
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?
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.
Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
http://student.vub.ac.be/~bvingerh/
Don't worry what people think about you. They're too busy wondering what you think about them.
RE: If...then Reserve?