编写一个程序,从键盘输入10个学生的成绩,统计平均值后输出,并同时输出高于平均分的所有成绩

如题所述

#include<iostream>
#include<fstream>
using namespace std;

void main(){
ofstream outfile("E:\\Salary.dat");
char name[6],number[4];
int jg,jb,jj,kc,sf;
for(int i=0;i<3;i++){
cout << "输入职工编号: "; cin >> number;
cout << "输入姓 名: "; cin >> name;
cout << "输入基本工资: "; cin >> jg;
cout << "输入加班工资: "; cin >> jb;
cout << "输入奖 金: "; cin >> jj;
cout << "输入扣 除: "; cin >> kc;
sf=jg+jb+jj-kc;
outfile << number << " " << name << " " << jg << " " << jb << " " << jj << " " << kc << " " << sf << endl;
}
outfile.close();
}
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答