别用int
2025-08-28 15:51:30
发布于:广东
30阅读
0回复
0点赞
用string!!!
全部评论 1
用int也行!:
#include<iostream>
using namespace std;int main(){
int n;
cin >> n;
if(n < 0){
cout << '-';
n -= n * 2;
}
else if(n == 0) cout << 0;
int x = 0;
while(n){
x = x * 10 + n % 10;
n /= 10;
}
cout << x;
return 0;
}2026-07-17 来自 江苏
0














有帮助,赞一个