mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-12-16 15:44:39 +00:00
94 lines
1.2 KiB
Markdown
94 lines
1.2 KiB
Markdown
|
# 6-1 输出星期名
|
||
|
|
||
|
请编写函数,根据星期数输出对应的星期名。
|
||
|
|
||
|
#### 函数原型
|
||
|
|
||
|
```
|
||
|
void ShowDayWeek(int dow);
|
||
|
```
|
||
|
|
||
|
说明:参数 dow 为星期数。若 dow 在 0 ~ 6 范围内,则输出“日”、“一”、“二”、...、“六”,否则不输出任何信息。
|
||
|
|
||
|
<table>
|
||
|
<tr>
|
||
|
<td align="center"><b>星期值</b></td>
|
||
|
<td align="center"><b>星期名</b></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="center">0</td>
|
||
|
<td align="center">日</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="center">1</td>
|
||
|
<td align="center">一</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="center">2</td>
|
||
|
<td align="center">二</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="center">3</td>
|
||
|
<td align="center">三</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="center">4</td>
|
||
|
<td align="center">四</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="center">5</td>
|
||
|
<td align="center">五</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="center">6</td>
|
||
|
<td align="center">六</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
#### 裁判程序
|
||
|
|
||
|
```c
|
||
|
#include <stdio.h>
|
||
|
|
||
|
void ShowDayWeek(int dow);
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
int w;
|
||
|
scanf("%d", &w);
|
||
|
ShowDayWeek(w);
|
||
|
putchar('\n');
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/* 你提交的代码将被嵌在这里 */
|
||
|
```
|
||
|
|
||
|
#### 输入样例 1
|
||
|
|
||
|
```in
|
||
|
3
|
||
|
|
||
|
```
|
||
|
|
||
|
#### 输出样例 1
|
||
|
|
||
|
```out
|
||
|
三
|
||
|
|
||
|
```
|
||
|
|
||
|
#### 输入样例 2
|
||
|
|
||
|
```in
|
||
|
9
|
||
|
|
||
|
```
|
||
|
|
||
|
#### 输出样例 2
|
||
|
|
||
|
```out
|
||
|
|
||
|
|
||
|
```
|