Sunday, March 17, 2013

Sorting

#include<iostream>
#include<iomanip>
#include<algorithm>
#include<functional>
using namespace std;
int main()
{
    double x[5];
    cout<<"\t\t\tEnter 5 numbers>>>>>>>\n";
    cout<<"\t\t\t______________________\n\n";
    for(int j=0;j<5;++j)
    {
        cout<<"Enter Num "<<j+1<<" : ";
        cin>>x[j];
    }
    sort(x,x+5,greater<int>());
    cout<<"The Arranged Decreasing Order: \n\n";
    for(int i=0;i<5;++i)
    cout<<"\t\n\n"<<x[i]<<" ";
    cout<<"\n";
    return 0;
}

0 comments:

Post a Comment