@[PURE_LOVE](/user/1189413) 你干脆写 C 语言吧这个没有用到一丁点 C++ 的东西
by heyx0201 @ 2023-11-29 19:35:43
除了头文件
by heyx0201 @ 2023-11-29 19:36:10
@[heyx0201](/user/768951) 我是在写c语言啊,c++还没学
by PURE_LOVE @ 2023-11-29 22:45:09
@[PURE_LOVE](/user/1189413) 《![](https://cdn.luogu.com.cn/upload/image_hosting/plx8bnxw.png)》
by heyx0201 @ 2023-11-30 12:50:55
@[heyx0201](/user/768951) 哦哦哦,刚发帖,要```c这样写是吧
by PURE_LOVE @ 2023-11-30 12:59:34
@[PURE_LOVE](/user/1189413) 是
by heyx0201 @ 2023-11-30 13:10:09
@[heyx0201](/user/768951) 那能麻烦你帮我看看吗
by PURE_LOVE @ 2023-11-30 13:45:35
我也是刚学,动态内存那学的不咋地,不过这道题不用这么复杂吧。我把代码贴在下面了。
by Kelly_1 @ 2023-12-22 21:05:19
```c
#include<stdio.h>
#include<math.h>
int main()
{
int n = 0;
scanf("%d", &n);
int i = 0, a[10] = { 0 }, b = n;
if (n < 0)
n = -n;
while (n > 0)
{
a[i] = n % 10;
n = n / 10;
i++;
}
n = b;
int num = 0, c = i - 1;
for (int j = 0;j < i;j++)
{
num = num + a[j] * pow(10, c);
c--;
}
if (n < 0)
num = -num;
printf("%d\n", num);
return 0;
}
```
by Kelly_1 @ 2023-12-22 21:07:22