对sort的进一步操作

Xredman posted @ Jun 16, 2009 01:58:38 AM in 以前博文 , 1253 阅读

 

#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
        vector<int> vec;
        vector<int>::iterator p;
        int cc;
        vec.clear();

        while(cin>>cc)
                vec.push_back(cc);

        sort(vec.begin(), vec.end());
        copy(vec.begin(), vec.end(), ostream_iterator<int>(cout, "  "));
        cout<<endl;
        sort(vec.begin(), vec.end(), greater<int>());
        copy(vec.begin(), vec.end(), ostream_iterator<int>(cout, "  "));

        return 0;
}

 

 






  • 无匹配
  • 无匹配
instagram profil lös 说:
Jul 19, 2023 02:46:19 AM

Instagram ist eine weltweit bekannte Anwendung für soziale Netzwerke. Es ermöglicht Benutzern, mit Personen auf der ganzen Welt zu sprechen und sich mit ihnen zu verbinden. Benutzer von Instagram haben die Möglichkeit, Fotos, Videos, Geschichten usw. instagram profil löschen zu teilen, um Follower zu gewinnen, was dazu beiträgt, als Berühmtheit zu wachsen, wenn Sie eine gewöhnliche Person sind.

West Bengal 6th Cla 说:
Aug 22, 2023 08:34:28 PM

West Bengal Education Board Committee will Desin and Every Year Latest Study Materiel Upload West Bengal Model Paper 2024 as Pdf Format Every year on the official website, Students need to Prepare for the Final Exam by Taking these West Bengal Question Paper 2024 as a Reference for Getting a good Percentage in the Examination 2024,West Bengal Question Paper 2024 Download here the Students West Bengal 6th Class Book 2024 of are Very Important for the Preparation of Final Examination 2024 Prepare yourself accordingly, Student Needs to Practice Various Types of Suggestions, will get a Better idea and Understanding About the totality of Examination 2024.

jnanabhumiap.in 说:
Jan 04, 2024 09:38:40 PM

JNANABHUMI AP provides all the latest educational updates and many more. The main concept or our aim behind this website has been the will to provide resources with full information on each topic which can be accessed through the Internet. jnanabhumiap.in To ensure that every reader gets what is important and worthy about the topic they search and link to hear from us.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter