dowens3rd 0 Newbie Poster

I am being asked to take a number like 86249 and produce the output 24689. Basically take a number and print it in ordered form. I can do this with an array of multiple numbers, but can't figure out how to split the number entered into an array so this can be done. Am I following the right logic or am I way off base?

#include<iostream.h>

void main()
{
	int arr[50];
	int size, temp;
	do{
	cout<<"Enter the size of the array(max 50):  ";
	cin>>size;
	}while(size>50 || size <1);
	cout<<"\nEnter the values: ";
	for(int i=0; i<size; i++)
		cin>>arr[i];
	for(i=0; i<size-1;i++)
		for(int j=i+1; j<size;j++)
			if(arr[i]>arr[j])
			{
				temp=arr[i];
				arr[i]=arr[j];
				arr[j]=temp;
			}
			cout<<"\nthe sorted array is:  ";
			for(i=0; i<size; i++)
				cout<<arr[i];
			cout<<"\n";
}