Skip to content

Instantly share code, notes, and snippets.

@praserocking
Created March 24, 2013 17:25
Show Gist options
  • Save praserocking/5232726 to your computer and use it in GitHub Desktop.
Save praserocking/5232726 to your computer and use it in GitHub Desktop.
#include<iostream>
#include<vector>
using namespace std;
int main()
{
vector<int> a;
int tmp;
for(int i=0;i<5;i++)
{
cin>>tmp;
a.push_back(tmp);
}
for(int i=0;i<5;i++)
{
for(int j=0;j<5-i-1;j++)
{
if(a[j]>a[j+1])
{
tmp=a[j];
a[j]=a[j+1];
a[j+1]=tmp;
}
}
}
for(int i=0;i<5;i++)
cout<<a[i]<<endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment