1130 数字反转

题目描述 Description

给定一个整数,请将该数各个位上数字反转得到一个新数。新数也应满足整数的常见形
式,即除非给定的原数为零,否则反转后得到的新数的最高位数字不应为零.

输入描述 Input Description

输入共 1 行,一个整数N

输出描述 Output Description

输出共 1 行,一个整数,表示反转后的新数。

样例输入 Sample Input

-380

样例输出 Sample Output

-83

数据范围及提示 Data Size & Hint

数据范围
-1,000,000,000 ≤ N≤ 1,000,000,000。


#include
#include
#include
using namespace std;
int main(){
	char chs[100] = {0};
	char ch;
	int i = 0;
	bool flag = false;
	while(cin>>ch){
		if(ch == '-'){
			flag = true;
			continue;
		}
		chs[i++] = ch;
	}
	for(int j = i-1; j>=0; j--){
		if(chs[j] == '0'){
		chs[j] = 0;
		i--;	
		}
		
		else break;
	}
	for(int j = 0; j


你可能感兴趣的:(CODE[VS],高精度,字符串)