⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 studentims.cpp

📁 程序说明C++编的程序 可以作为学生管理系统
💻 CPP
字号:
#include<iostream>
#include<fstream>
#include <cstring>
#include"CBaseStudent.h"
#include <iomanip>
void Swap(double &x,double &y)
{   
double temp;
	temp=x;
	x=y;
	y=temp;
}	
void  gementop(CStudent st1[6]);
void  fail(CStudent st2[6]);
void  topave(CStudent st3[ 6]);
void  totalfail(CStudent st4[6]);
void  gemenaver(CStudent st5[6]);
using namespace std;
struct stu
{
	int no;
	char name1[20];
	double p1,p2,p3,p4,p5,p6,p7;
};
void main()
{       

        CStudent      CS[6]; 
		stu st[6];
		ifstream infile("mark.txt",ios_base::in);
		for(int j=0;j<6;j++ )
		{
			infile>>st[j].no>>st[j].name1>>st[j].p1>>st[j].p2>>st[j].p3>>st[j].p4>>st[j].p5>>st[j].p6>>st[j].p7;
			cout<<st[j].name1<<" "<<st[j].no<<" "<<st[j].p1<<" "<<st[j].p2<<" "<<st[j].p3<<" "<<st[j].p4<<" "<<st[j].p5<<" "<<st[j].p6<<" "<<st[j].p7<<endl;
		}
	 	for(int m=0;m<6;m++)
		{
			
			CS[m].Setnum(st[m].no);
	        CS[m].Setname(st[m].name1);
			CS[m].Setmaths(st[m].p1);
			CS[m].Setenglish(st[m].p2);
			CS[m].Setphysics(st[m].p3);
			CS[m].Setvc(st[m].p4);
			CS[m].Setftenet(st[m].p5);
			CS[m].Setsports(st[m].p6);
			CS[m].Setpolitics(st[m].p7); 
			CS[m].Display();
		 
		 
		}
		gementop(CS);cout<<endl;
	    fail(CS);cout<<endl;
	    topave(CS);cout<<endl;
	    totalfail(CS);cout<<endl;
	    gemenaver(CS); cout<<endl;


        double a1;
        double r1;
		double a2;
	    double a3;
        double a4;
		double a5;
		double zhonghe[6];
		for (int k=0;k<6;k++)
		{   
			cout<<"输入"<<CS[k].Getname()<<"的奖励分和扣分"<<endl;
		    cin>>a1>>r1>>a2>>a3>>a4>>a5;
		    CS[k].Setadd1(a1);
        	CS[k].Setred1(r1);
	        CS[k].Setadd2(a2);
			CS[k].Setadd3(a3);
			CS[k].Setadd4(a4);
			CS[k].Setadd5(a5);
			zhonghe[k]=CS[k].zonghe();
            cout<<CS[k].Getname()<<"的德育积分"<<CS[k].deyu()<<endl;
            cout<<CS[k].Getname()<<"的智育积分"<<CS[k].zhiyu()<<endl;
			cout<<CS[k].Getname()<<"的体育积分"<<CS[k].tiyu()<<endl;
			cout<<CS[k].Getname()<<"的综合测评分"<<CS[k].zonghe()<<endl;                 
		}
       int	max1;
        for (int a=0;a<5;a++)
		{  
			max1=a;
			for(int b=a+1;b<6;b++)
			{
			
		    	if(zhonghe[b]>zhonghe[max1])
				
					max1=b;
				    Swap(zhonghe[max1],zhonghe[a]);
			}
			
		}
	 
        ofstream outfilemain("414综合测评.txt");
        outfilemain<<"  序号"<<"   "<<" 姓名"<<"   "<<"项目"<<"  "<<" 奖分"<<"  "<<"各项总分"<<"  "<<"最后得分"<<"  "<<"综合测评得分"<<"  "<<"综合测评名次"<<"  "<<"平均学分绩点"<<endl;
		for(int c=0;c<6;c++)
		{
			for(int d=0;d<6;d++)
			{
				if(CS[c].zonghe()==zhonghe[d])
				{   
					outfilemain<<setw(23)<<"德育积分"<<"  "<<CS[c].deyu()-100<<"    "<<CS[c].deyu()<<setw(10)<<CS[c].deyu()*0.3<<endl;
                    outfilemain<<CS[c].Getnum()<<" "<<setw(4)<<CS[c].Getname()<<"  "<<"智育积分"<<"  "<<CS[c].Getadd4()<<"    "<<CS[c].zhiyu()<<setw(11)<<CS[c].zhiyu()*0.6<<"   "<<CS[c].zonghe()<<setw(12)<<d+1<<setw(18)<<CS[c].aver2()<<endl;
					outfilemain<<setw(23)<<"体育积分"<<"  "<<CS[c].tiyu()-CS[c].Getsports()<<"    "<<CS[c].tiyu()<<setw(12)<<CS[c].tiyu()*0.1<<endl;
                    outfilemain<<endl;
					break;
				}
			}
		} 
		outfilemain.close();
}



		

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -