#include<iostream>
#include<iomanip>
using namespace std;
const int N = 5;
class t
{
public:
void input(class t *p, int n);
void average(class t stu[], int n);
void order(class t stu[], int n);
void output(class t stu[], int n);
void pow(class t stu[], int n);
private:
char name[10];
float money[4];
};
void t::input(class t *p, int n)
{
int i, j;
for (i = 0; i < n; p++, i++)
{
cout << "请输入姓名,基本工资,浮动工资,奖金" << endl;
cin >> p->name;
for (j = 0; j < 3; j++)
cin >> p->money[j];
}
}
void t::average(class t stu[], int n)
{
int i, j;
for (i = 0; i < 5; i++)
{
stu[i].money[3] = 0;
for (j = 0; j < 3; j++)
{
stu[i].money[3] += stu[i].money[j];
}
}
}
void t::order(class t stu[], int n)
{
int i, j;
for (i = 0; i < n - 1; i++)
for (j = 0; j < n - 1 - i; j++)
{
if (stu[j].money[3] > stu[j + 1].money[3])
{
t tem;
tem = stu[j + 1];
stu[j + 1] = stu[j];
stu[j]= tem;
}
}
}
void t::output(class t stu[], int n)
{
int i, j;
cout << "-------------------------------------------------------------" << endl;
cout << setw(10) << "姓名" << setw(10) << "基本工资" << setw(10) << "浮动工资" << setw(10) << "奖金" << setw(10) << "总工资" << endl;
for (i = 0; i < n; i++)
{
cout << setw(10) << stu[i].name;
for (j = 0; j < 4; j++)
{
cout << setw(8) << stu[i].money[j] << " ";