[ create a new paste ] login | about

Link: http://codepad.org/H9pemQKm    [ raw code | output | fork ]

C++, pasted on Dec 25:
#include <string>
#include <algorithm>
#include <locale>
#include <iostream>
#include <sstream>

int transform(int i)
{
	std::stringstream ss;
	ss << i;

	std::string s = ss.str();
	std::sort(s.begin(), s.end());

	ss.str(s);
	ss >> i;

	return i;
}

int main()
{
	setlocale(LC_ALL, "");

	std::cout << transform(98765) << std::endl;

	return 0;
}


Output:
1
56789


Create a new paste based on this one


Comments: