题目描述:
输入不限长度的字符数字,经过函数处理,输出的数字为最小值,其中0在开头无效。
例:
输入 026148
输出 102468
这是一开始想到的方法,最初的版本没有考虑到数字不限长度的问题,这里就不附上了。
主要思想就是字符串转换成数字,排序,再把数字转换成字符串输出(如果以数字形式输出,就不满足限长度的要求)
#include<iostream>
#include<string>
#include<sstream>
using namespace std;
int main()
{
cout << "please input the number:" << endl;
string str;
cin >> str;
int str_leng