mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-12-16 15:44:39 +00:00
38 lines
642 B
Markdown
38 lines
642 B
Markdown
|
# 6-5 两个4位正整数的后两位互换
|
|||
|
|
|||
|
|
|||
|
将输入的任意两个4位正整数的后两位互换,例如输入1234和5678,交换之后输出1278和5634。
|
|||
|
|
|||
|
### 函数接口定义:
|
|||
|
```c++
|
|||
|
void fun(int *p,int *q);
|
|||
|
```
|
|||
|
|
|||
|
其中` p `和 `q` 是用户传入的参数。函数将指针`p`所指整数与指针`q`所指的整数的后两位互换。
|
|||
|
|
|||
|
### 裁判测试程序样例:
|
|||
|
```c++
|
|||
|
|
|||
|
void fun(int *p,int *q);
|
|||
|
int main()
|
|||
|
{int a,b;
|
|||
|
scanf("%d%d",&a,&b);
|
|||
|
fun(&a,&b);
|
|||
|
printf("%5d%5d\n",a,b);
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/* 请在这里填写答案 */
|
|||
|
```
|
|||
|
|
|||
|
### 输入样例:
|
|||
|
```in
|
|||
|
1234 5678
|
|||
|
```
|
|||
|
|
|||
|
### 输出样例:
|
|||
|
```out
|
|||
|
1278 5634
|
|||
|
```
|