mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-11-27 08:26:20 +00:00
48 lines
623 B
Markdown
48 lines
623 B
Markdown
|
# 6-6 重复显示(递归)
|
|||
|
|
|||
|
请编写函数,重复显示字符。
|
|||
|
|
|||
|
#### 函数原型
|
|||
|
|
|||
|
```
|
|||
|
void Show(int number, char symbol);
|
|||
|
```
|
|||
|
|
|||
|
说明:参数 number 为自然数,symbol 为显示字符。函数将重复输出 number 个 symbol 字符。
|
|||
|
|
|||
|
#### 裁判程序
|
|||
|
|
|||
|
```c
|
|||
|
#include <stdio.h>
|
|||
|
|
|||
|
void Show(int number, char symbol);
|
|||
|
|
|||
|
int main()
|
|||
|
{
|
|||
|
int n;
|
|||
|
char s;
|
|||
|
scanf("%d %c", &n, &s);
|
|||
|
Show(n, s);
|
|||
|
putchar('\n');
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
/* 你提交的代码将被嵌在这里 */
|
|||
|
```
|
|||
|
|
|||
|
要求:用递归方法完成函数的设计,不得使用循环语句。
|
|||
|
|
|||
|
#### 输入样例
|
|||
|
|
|||
|
```in
|
|||
|
5 *
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
#### 输出样例
|
|||
|
|
|||
|
```out
|
|||
|
*****
|
|||
|
|
|||
|
```
|