Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 case construct, a problem
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
lashari




PostPosted: Thu Mar 04, 2004 10:49 pm   Post subject: case construct, a problem

in this program when i type "Monday" in the execution window with the capital "M", it displays the message "mow the lawn" otherwise it would not work, can somebody modify this program so that it will work correctly whether or not the dayof the week is entered with a capital letter.

var day : string
put "Enter the day of the week. " ..
get day
case day of
label "Monday" :
put "mow the lawn"
label "Tuesday" :
put "do the laundry"
label "Wednesday" :
put "shop for groceries"
label "Thursday" :
put "vaccuum the carpets"
label "Friday" :
put "wash the windows"
label "Saturday" :
put "wash the car"
label "Sunday" :
put "take a break"
label :
put "That wasn't a day that I recognize."
end case
Sponsor
Sponsor
Sponsor
sponsor
zylum




PostPosted: Thu Mar 04, 2004 11:01 pm   Post subject: (No subject)

var day : string
put "Enter the day of the week. " ..
get day
case day of
label "Monday","monday" :
put "mow the lawn"
label "Tuesday","tuesday" :
put "do the laundry"

etc...

just put a common and the alternate spelling/caps

-zylum
Hackster




PostPosted: Sat Mar 06, 2004 2:53 pm   Post subject: (No subject)

wow this site has everything, i also need help with case, thanx
zylum




PostPosted: Sat Mar 06, 2004 3:21 pm   Post subject: (No subject)

what exactly is your problem?
appling




PostPosted: Wed Mar 10, 2004 8:54 pm   Post subject: (No subject)

do u mean this?
code:

var day : string
put "Enter the day of the week. " ..
get day
case day of
    label "Monday", "M", "m" :
        put "mow the lawn"
    label "Tuesday", "T", "t" :
        put "do the laundry"
    label "Wednesday", "W", "w" :
        put "shop for groceries"
    label "Thursday", "Th", "th" :
        put "vaccuum the carpets"
    label "Friday", "F", "f" :
        put "wash the windows"
    label "Saturday", "Sa", "sa" :
        put "wash the car"
    label "Sunday", "S", "s" :
        put "take a break"
    label :
        put "That wasn't a day that I recognize."
end case
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: