case construct, a problem
Author |
Message |
lashari
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
zylum
![](http://compsci.ca/v3/uploads/user_avatars/1689129126468091c334ee0.gif)
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
Hackster
![](http://www.compsci.ca/v2/shop/images/turing.gif)
|
Posted: Sat Mar 06, 2004 2:53 pm Post subject: (No subject) |
|
|
wow this site has everything, i also need help with case, thanx |
|
|
|
|
![](images/spacer.gif) |
zylum
![](http://compsci.ca/v3/uploads/user_avatars/1689129126468091c334ee0.gif)
|
Posted: Sat Mar 06, 2004 3:21 pm Post subject: (No subject) |
|
|
what exactly is your problem? |
|
|
|
|
![](images/spacer.gif) |
appling
![](http://www.squarecn.com/ff/pictures//FF10/gif/rikku2.gif)
|
Posted: 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 |
|
|
|
|
|
![](images/spacer.gif) |
|
|