國立屏東商業技術學院 資訊工程系 程式設計(一)
練習if, switch與條件運算式。
turnin code c.hw7
[1:18 user@ws ~] ./a.out Input your score: 80 You are pass! [1:18 user@ws ~] ./a.out Input your score: 59 You are fail! [1:18 user@ws ~] ./a.out Input your score: 110 Error! [1:18 user@ws ~] ./a.out Input your score: -10 Error!
\\
[1:18 user@ws ~] ./a.out Please input a number: 3 The sum of 1 to 3 is 6. [1:18 user@ws ~] ./a.out Please input a number: 12 Your input larger than 10. [1:18 user@ws ~] ./a.out Please input a number: 0 Error
day | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday |
---|---|---|---|---|---|---|---|
wake up time | 7:30 | 8:30 | 8:30 | 7:30 | 8:30 | 10:00 | 10:00 |
[1:18 user@ws ~] ./a.out Input (0-6) : 3 You have to wake up on 8:30. [1:18 user@ws ~] ./a.out Input (0-6) : 1 You have to wake up on 7:30. [1:18 user@ws ~] ./a.out Input (0-6) : 0 You have to wake up on 10:00.
grade | A | B | C | D | E |
---|---|---|---|---|---|
comment | Excellent | Good | Average | Poor | Failing |
[1:18 user@ws ~] ./a.out Grade (A-E) : A Excellent [1:18 user@ws ~] ./a.out Grade (A-E) : c Average [1:18 user@ws ~] ./a.out Grade (A-E) : E Failing
[1:18 user@ws ~] ./a.out Enter month (1-12): 6 Enter day (1-31): 1 Your input date is the 1st day of June. [1:18 user@ws ~] ./a.out Enter month (1-12): 7 Enter day (1-31): 11 Your input date is the 11th day of July. [1:18 user@ws ~] ./a.out Enter month (1-12): 8 Enter day (1-31): 2 Your input date is the 2nd day of August. [1:18 user@ws ~] ./a.out Enter month (1-12): 6 Enter day (1-31): 21 Your input date is the 21st day of June.