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

📄 成绩管理系统.cpp

📁 简单的成绩管理系统 大一主要学习了C和C++
💻 CPP
📖 第 1 页 / 共 2 页
字号:
#include<iostream.h>
#include<string.h>
#include<fstream.h>
#include<stdlib.h>
#include<windows.h>

class Stu
{
public:
	char name[8];
	int  number;
	double English,Math,Gailiu,Cjj,DigitalL,Total,Average;
	Stu()
	{
		English=0;Math=0;Gailiu=0;Cjj=0;DigitalL=0;Total=0;number=0;strcpy(name,"无");
		return;
	}
	Stu(double Eng,double Mat,double Gai,double C,double Dig,int num,char s3[8]);
	void getname();
    void getnumber();
    void getEnglish();
    void getMath();
	void getGailiu();      //Gailiu表示概率论与数理统计
    void getCjj();
	void getDigitalL();    //DigitalL表示数字逻辑    
    double gettotal();
    double getaverage();
}; 
Stu::Stu(double Eng,double Mat,double Gai,double C,double Dig,int num,char s3[8])
{
	English=Eng;Math=Mat;Gailiu=Gai;Cjj=C;DigitalL=Dig;number=num;strcpy(name,s3);
}
void Stu::getname()
{                                       
	char s[8];
	cout<<"名字:";
	cin>>s;
    strcpy(name,s);
}
void Stu::getnumber()
{                                         
	int n;
	cout<<"学号:";
	cin>>n;
	number=n;
}
void Stu::getEnglish()
{                                         
	double E;
	cout<<"英语:";
	cin>>E;
	English=E;
}
void Stu::getMath()
{                                         
	double m;
	cout<<"高数:";
	cin>>m;
	Math=m;
}
void Stu::getGailiu()
{                                         
	double g;
	cout<<"概论:";
	cin>>g;
	Gailiu=g;	
}
void Stu::getCjj()
{                                         
	double c;
	cout<<"C++:";
	cin>>c;
	Cjj=c;
}
void Stu::getDigitalL()
{                                         
	double D;
	cout<<"数逻:";
	cin>>D;
	DigitalL=D;
	cout<<endl;
}
double Stu::gettotal()
{                                        
	return Total=English+Math+Gailiu+Cjj+DigitalL;
}
double Stu::getaverage()
{                                       
	return Average=Total/5.0;
}
void output(Stu &p)
{
	                                    
	cout<<"\t\t"<<p.name<<"\t"<<p.number<<"\t"<<p.English<<"\t"<<p.Math<<"\t"<<p.Gailiu<<"\t"<<p.Cjj<<"\t"<<p.DigitalL<<"\n";
}
void output1(Stu &p)
{
    cout<<"\t"<<p.name<<"\t"<<p.number<<"\t"<<p.English<<"\t"<<p.Math<<"\t"<<p.Gailiu<<"\t"<<p.Cjj<<"\t"<<p.DigitalL<<"\t"<<p.Average
		<<"\t"<<p.Total<<"\n";
}
void input(Stu &p)
{                                        
   p.getname();
   p.getnumber();
   p.getEnglish();
   p.getMath();
   p.getGailiu();
   p.getCjj();
   p.getDigitalL();
   p.gettotal();
   p.getaverage();
   return;
}
 void order(Stu &p1,Stu &p2,Stu &p3,Stu &p4,Stu &p5,Stu &p6)
{	
sheji:
   int  number[6]={p1.number,p2.number,p3.number,p4.number,p5.number,p6.number};
   char  *name[6]={p1.name,p2.name,p3.name,p4.name,p5.name,p6.name};
   double  math[6]={p1.Math,p2.Math,p3.Math,p4.Math,p5.Math,p6.Math};
   double  english[6]={p1.English,p2.English,p3.English,p4.English,p5.English,p6.English};
   double  Gailiu[6]={p1.Gailiu,p2.Gailiu,p3.Gailiu,p4.Gailiu,p5.Gailiu,p6.Gailiu};
   double  Cjj[6]={p1.Cjj,p2.Cjj,p3.Cjj,p4.Cjj,p5.Cjj,p6.Cjj};
   double  DigitalL[6]={p1.DigitalL,p2.DigitalL,p3.DigitalL,p4.DigitalL,p5.DigitalL,p6.DigitalL};
   double  average[6]={p1.Average,p2.Average,p3.Average,p4.Average,p5.Average,p6.Average};
   double  total[6]={p1.Total,p2.Total,p3.Total,p4.Total,p5.Total,p6.Total};
	Stu soure[6]={p1,p2,p3,p4,p5,p6};
	char *s1,s2[8];
	int  n;
    double  mat;
    double *p;
	cout<<"\t      ***********查寻总分排名请按1*********"<<endl;
	cout<<"\t      ***********查询英语排名请按2*********"<<endl;
	cout<<"\t      ***********查询高数排名请按3*********"<<endl;
	cout<<"\t      *****查询概率论和数理统计排名请按4***"<<endl;
	cout<<"\t      ************查询c++排名请按5*********"<<endl;
	cout<<"\t      ********查询数字逻辑排名请按6********"<<endl;
	cout<<"\t      ************查询个人情况请按7********"<<endl;
	cout<<"\t      ********查询各科平均成绩请按8********"<<endl;
	cout<<"\t      **查询各科各分数段人数所占比例请按9**"<<endl;
	cout<<"\t      **********存储个人成绩请按10*********"<<endl;
	cout<<"\t      **********读取个人成绩请按11*********"<<endl;
	cout<<"\t      ***********增加1个人请按12***********"<<endl;
	cout<<"\t      ***********删除1个人请按13***********"<<endl;
    cout<<"\t      ***********修改1个人请按14***********"<<endl;
	cout<<"\t      *************退出请按0***************"<<endl;
	int q;
	cin>>q;

    if(q==1)
	{
	    p=total;
	    cout<<"\t#################以总分成绩排名##################"<<endl;
		strcpy(s2,"总分");
	}
	else if(q==2)
	{
		p=english;
        cout<<"\t#################以英语成绩排名##################"<<endl;
		strcpy(s2,"英语");
	}
	else if(q==3)
	{
		p=math;
        cout<<"\t#################以高数成绩排名##################"<<endl;
		strcpy(s2,"数学");
	}
	else if(q==4)
	{
		p=Gailiu;
        cout<<"\t#################以概率论和数理统计成绩排名##################"<<endl;
		strcpy(s2,"概率数统");
	}
	else if(q==5)
	{
		p=Cjj;
        cout<<"\t#################以c++成绩排名##################"<<endl;
		strcpy(s2,"c++");
	}
	else if(q==6)
	{
		p=DigitalL;
        cout<<"\t#################以数字逻辑成绩排名##################"<<endl;
		strcpy(s2,"数字逻辑");
	}
	else if(q==7)
	{   
		int w;
		cout<<"请输入要查询人的学号:"<<endl;
        cin>>w;
        cout<<"\t姓名\t学号\t英语\t高数\t概论\tC++\t数逻\t均分\t总分"<<"\n";
        for(int f=0;f<6;f++)
        if(w==number[f])
        output1(soure[f]);
		goto sheji;
	}
	else if(q==8)
	{
		cout<<"\t      ############各科平均成绩#############"<<endl;
        static double a1=0,b=0,d=0,e=0,h=0;                          //平均分的各种情况我用for及if语句做的
		for(int j=0;j<6;j++)
		{
	       a1+=english[j];
		}
		cout<<"\t\t\t英语的平均分为\t"<<(double (a1/5.0))<<endl;
		for(j=0;j<6;j++)
		{
			b+=math[j];
		}
		cout<<"\t\t\t高数的平均分为\t"<<(double (b/5.0))<<endl;
		for(j=0;j<6;j++)
		{
		    d+=Gailiu[j];
		}
		cout<<"\t\t\t概论的平均分为\t"<<(double (d/5.0))<<endl;
		for(j=0;j<6;j++)
		{
			e+=Cjj[j];
		}
		cout<<"\t\t\tC++ 的平均分为\t"<<(double (e/5.0))<<endl;
		for(j=0;j<6;j++)
		{
			h+=DigitalL[j];
		}
		cout<<"\t\t\t数逻的平均分为\t"<<(double (h/5.0))<<endl;
		goto sheji;
	}
	else if(q==9)
	{
		cout<<"本系统定义各科成绩大于等于90分的为优秀,大于等于80小于90的为良好,大于等于70小于80的为中等,大于等于60小于70的为及格,小于60的为不及格"<<endl;
		cout<<"SB优数  优率\t良好\t良率\t中等\t中率\t及格\t及格率\t不及\t不及率"<<endl;
		cout<<"┍─────────────────────────────────────┓"<<endl;
        static int d1,d2,d3,d4,d5;                          
		for(int i=0;i<6;i++)
		{
			if(english[i]>=90)
			{
		        d1++;
			}
		}
		cout<<"│英语"<<d1<<"\t"<<(int (d1/5.0*100.0))<<"%";
		for(i=0;i<6;i++)
		{
			if(english[i]>=80&&english[i]<90)
			{
		        d2++;
			}
		}
		cout<<"\t"<<d2<<"\t"<<(int (d2/5.0*100.0))<<"%";
		for(i=0;i<6;i++)
		{
			if(english[i]>=70&&english[i]<80)
			{
		        d3++;
			}
		}
		cout<<"\t"<<d3<<"\t"<<(int (d3/5.0*100.0))<<"%";
		for(i=0;i<6;i++)
		{
			if(english[i]>=60&&english[i]<70)
			{
		        d4++;
			}
		}
		cout<<"\t"<<d4<<"\t"<<(int (d4/5.0*100.0))<<"%";
		for(i=0;i<6;i++)
		{
			if(english[i]>0&&english[i]<60)
			{
		        d5++;
			}
		}
		cout<<"\t"<<d5<<"\t"<<(int (d5/5.0*100.0))<<"%"<<"│"<<endl;
		cout<<"┝─────────────────────────────────────┫"<<endl;
		static int x1,x2,x3,x4,x5;                         
		for(int k=0;k<6;k++)
		{
			if(math[k]>=90)
			{
		        x1++;
			}
		}
		cout<<"│高数"<<x1<<"\t"<<(int (x1/5.0*100.0))<<"%";
		for(k=0;k<6;k++)
		{
			if(math[k]>=80&&math[k]<90)
			{
		        x2++;
			}
		}
		cout<<"\t"<<x2<<"\t"<<(int (x2/5.0*100.0))<<"%";
		for(k=0;k<6;k++)
		{
			if(math[k]>=70&&math[k]<80)
			{
		        x3++;
			}
		}
		cout<<"\t"<<x3<<"\t"<<(int (x3/5.0*100.0))<<"%";
		for(k=0;k<6;k++)
		{
			if(math[k]>=60&&math[k]<70)
			{
		        x4++;
			}
		}
		cout<<"\t"<<x4<<"\t"<<(int (x4/5.0*100.0))<<"%";
		for(k=0;k<6;k++)
		{
			if(math[k]>0&&math[k]<60)
			{
		        x5++;
			}
		}
		cout<<"\t"<<x5<<"\t"<<(int (x5/5.0*100.0))<<"%"<<"│"<<endl;
		cout<<"┝─────────────────────────────────────┫"<<endl;
		static int y1,y2,y3,y4,y5;                         
		for(int l=0;l<6;l++)
		{
			if(Gailiu[l]>=90)
			{
		        y1++;
			}
		}
		cout<<"│概论"<<y1<<"\t"<<(int (y1/5.0*100.0))<<"%";
		for(l=0;l<6;l++)
		{
			if(Gailiu[l]>=80&&Gailiu[l]<90)
			{
		        y2++;
			}
		}
		cout<<"\t"<<y2<<"\t"<<(int (y2/5.0*100.0))<<"%";
		for(l=0;l<6;l++)
		{
			if(Gailiu[l]>=70&&Gailiu[l]<80)
			{
		        y3++;
			}
		}
		cout<<"\t"<<y3<<"\t"<<(int (y3/5.0*100.0))<<"%";
		for(l=0;l<6;l++)
		{
			if(Gailiu[l]>=60&&Gailiu[l]<70)
			{
		        y4++;
			}
		}
		cout<<"\t"<<y4<<"\t"<<(int (y4/5.0*100.0))<<"%";
		for(l=0;l<6;l++)
		{
			if(Gailiu[l]>0&&Gailiu[l]<60)
			{

⌨️ 快捷键说明

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