enum用法实例C++
帮忙写一个.
————————————————————————————
Keyinatimeofhourrandomly,printgoodmorning/noon/afternoon/evening/nightrespectively.
Requirement:useEnumerationconstant.
Notethattheroughlypartitionofadayisasfollow:
1)Morning:Thefirstorearlypartoftheday,lastingfrommidnighttonoonorfromsunrisetonoon.Sixo'clockcouldbethestartoftheinterval.
2)Noon:Twelveo'clockinthedaytime;midday.
3)Afternoon:Thepartofdayfromnoonuntilsunset.Say,after13o’clock.
4)Evening:Theperiodofdecreasingdaylightbetweenafternoonandnight,aftereighteeno’clock.
5)Night:Theperiodbetweensunsetandsunrise,especiallythehoursofdarkness.Toensurethewholedayandnightareincluded,wesuggestthatitbeginat21o’clock.
I/OExamples:
8
goodmorning.
12
goodnoon.
17
goodafternoon.
19
goodevening.
22
goodnight.
-1
theinputisinvalid.
Notethattheinput/outputmustfollowtheaboveformat.
邮箱: 联系方式: