//input.h
#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;
class Input
{
public:
	void Add();//添加数据
	float Getsort();
private:
	vector<int> n;
};

void Input::Add()
{
	int temp=0;
	cout<<"请输入数字"<<endl;
	while(cin>>temp)
	{
		n.push_back(temp);
	}
}

float Input::Getsort()
{
	float sum=0;
	sort(n.begin(),n.end());
	n.erase(n.begin());
	n.erase(n.end()-1);

	for (int i=0;i<n.size();i++)
		sum+=n[i];
	return sum/n.size();
}

相关文章:

  • 2021-08-01
  • 2022-12-23
  • 2021-12-27
  • 2021-08-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2022-01-07
  • 2021-09-05
相关资源
相似解决方案