#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <string>
using namespace std;
int testscore[] = {67, 56, 24, 78, 99, 87, 56};

bool pass(int n)
{
if (n>=60)
return true;
else
return false;
}

void main()
{
vector<int> score(testscore,testscore+sizeof(testscore)/sizeof(int));
vector<int>::iterator it;

for (it=score.begin();it!=score.end();it++)
{
cout<<*it<<"";
}
cout<<endl;

sort(score.begin(),score.end());

for (it=score.begin();it!=score.end();it++)
{
cout<<*it<<"";
}
cout<<endl;

it=max_element(score.begin(),score.end());
cout<<"max is:"<<*it<<endl;

it=min_element(score.begin(),score.end());
cout<<"min is:"<<*it<<endl;

for (it=score.begin();it!=score.end();it++)
{
if(!pass(*it))
{
cout<<*it<<endl;
}
}

cout<<"the number of pass people:"<<count_if(score.begin(),score.end(),pass)<<endl;
int total=accumulate(score.begin(),score.end(),0);
cout<<total<<endl;

}

相关文章:

  • 2022-12-23
  • 2020-07-11
  • 2021-08-20
  • 2021-06-19
  • 2022-03-06
猜你喜欢
  • 2021-07-29
  • 2021-10-20
  • 2021-12-05
  • 2021-06-26
  • 2021-05-12
  • 2021-12-10
  • 2022-02-02
相关资源
相似解决方案