Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- bool compare(int a, int b){
- if(a>b){
- return true;
- }
- return false;
- }
- int main(){
- vector<int>v;
- v.push_back(64); v.push_back(71) ;v.push_back(32) ; v.push_back(81) ; v.push_back(93); v.push_back(78);
- sort(v.begin(), v.end());
- cout<<"in asending order : "<<endl;
- for(int i = 0; i<v.size(); i++){
- cout<<v[i]<<" ";
- }
- cout<<endl;
- sort(v.begin(), v.end(), compare);
- cout<<"in desending order : "<<endl;
- for(int i = 0; i<v.size(); i++){
- cout<<v[i]<<" ";
- }
- cout<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement