mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-12-16 15:44:39 +00:00
36 lines
688 B
Markdown
36 lines
688 B
Markdown
|
# 6-3 字符串反正序连接
|
|||
|
|
|||
|
先将在字符串s中的字符按逆序存放到t串中,然后把s中的字符按正序连接到t串的后面。
|
|||
|
|
|||
|
### 函数接口定义:
|
|||
|
```c++
|
|||
|
void fun (char *s, char *t);
|
|||
|
```
|
|||
|
|
|||
|
其中` s `和 `t `都是用户传入的参数。函数先将在字符串`s`中的字符按逆序存放到`t`串中,然后把`s`中的字符按正序连接到`t`串的后面。
|
|||
|
|
|||
|
### 裁判测试程序样例:
|
|||
|
```c++
|
|||
|
#include <stdio.h>
|
|||
|
void fun (char *s, char *t);
|
|||
|
int main()
|
|||
|
{ char s[100], t[100];
|
|||
|
scanf("%s", s);
|
|||
|
fun(s, t);
|
|||
|
printf("%s\n", t);
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
/* 请在这里填写答案 */
|
|||
|
```
|
|||
|
|
|||
|
### 输入样例:
|
|||
|
```in
|
|||
|
abcd
|
|||
|
```
|
|||
|
|
|||
|
### 输出样例:
|
|||
|
```out
|
|||
|
dcbaabcd
|
|||
|
```
|