Posted: Wed May 16, 2007 7:48 am Post subject: help with selection exercises
Please i need help for my computer programming class and our teacher never taught us this stuff heres the question:
Write a program to divide a class of students in two groups: those whose last names begin with A to H and those that begin with I to Z. Ask a person to enter their last name and the output a message indicating which group they are in. Repeat for each student.
any tips or code would be greatly appreciated.
Sponsor Sponsor
goblue21
Posted: Wed May 16, 2007 8:31 am Post subject: Re: help with selection exercises
Alright i made some code and it seems to only be working for lower case and im trying to get upper case to work can someone please help.
var firstname, lastname : string
put "type your first name"
get firstname
delay (100)
put "type you last name"
get lastname
delay (100)
if lastname <= "j" or lastname <= "J" then
put "you are in group one"
elsif lastname >= "h" or lastname >= "H" then
put "you are in group two"
end if
DIIST
Posted: Wed May 16, 2007 5:21 pm Post subject: Re: help with selection exercises
Turing:
if(lastname >= "a"and lastname <= "j")or(lastname >= "A"and lastname <= "J")then put"you are in group one" else put"you are in group two" endif
^This should help. You dont need to have an elsif.
goblue21
Posted: Thu May 17, 2007 8:02 am Post subject: Re: help with selection exercises