编写一个程序,从键盘输入10个学生的成绩,统计平均值后输出,并同时输出高于平均分的所有成绩
1个回答
展开全部
#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();
}
#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();
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询