Skip to content

Instantly share code, notes, and snippets.

@ErisianArchitect
Created March 8, 2012 21:04
Show Gist options
  • Save ErisianArchitect/2003444 to your computer and use it in GitHub Desktop.
Save ErisianArchitect/2003444 to your computer and use it in GitHub Desktop.
sort
int arr[5];
int input = 0;
arr[0] = INT_MAX;
arr[1] = INT_MAX;
arr[2] = INT_MAX;
arr[3] = INT_MAX;
arr[4] = INT_MAX;
for(int i = 0; i < 5; i++)
{
cin >> input;
for(int n = 0; n < 5; n++)
{
if(input < arr[n])
{
Insert<int>(arr,n,5,input);
break;
}
}
}
for(int i = 0; i < 5; i++)
{
cout << arr[i] << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment