...曹大官子...


私信TA

用户名:uq_79155536730

访问量:599

签 名:

等  级
排  名 4218
经  验 1668
参赛次数 0
文章发表 3
年  龄 0
在职情况 学生
学  校
专  业

  自我简介:

#include<bits/stdc++.h>

using namespace std;

class MyPrint

{

public:

 void operator()(int num)const

 {

  cout << num << " ";

 }

};
//自定义排序方法
class MyCompare

{

public:

 bool operator()(int num1, int num2)const

 {

  return num1 > num2;

 }

};

int main()

{

 vector<int>v;

 for(int i = 0; i < 3; i++)

 {

  int num;

  cin >> num;

  v.push_back(num);

 }

 sort(v.begin(), v.end(),MyCompare());

 for_each(v.begin(), v.end(),MyPrint());

 return 0;

}

解题思路:

注意事项:

参考代码:

 

0.0分

1 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区