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

📄 brower.cpp

📁 大二时做的课程设计
💻 CPP
字号:
// Brower.cpp: implementation of the CBrower class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Brower.h"
#include<iostream>
#include<iomanip>
#include<vector>
#include "ManageStudent.h"
using namespace std;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
ostream&operator<<(ostream&os,const CStudent&st);






extern CManageStudent*pBase;
void CBrower::ShowMenu(){
	cout<<endl;
	cout<<"*************************查找************************************\n";
	cout<<"1 原始成绩\t2 平均成绩\t3 成绩分析\t4 学分\t0 退出\n";
	cout<<"*****************************************************************\n";
}
void CBrower::DoEvent(int ID){
	switch(ID){
		case 1:
			OnOrigin();
			break;
		case 2:
			OnAverage();
			break;
		case 3:
			OnScoreAnasys();
			break;
		case 4:
			OnCredit();
			break;
		case 0:
			cout<<"退出预览菜单\n";
			pBase=parent;
			delete this;
			break;
		default:
			OnInvalidateInput("输入,,,");
			break;
	}

}



void CBrower::OnOrigin(){
	vector<CStudent>::iterator it=data.begin();
	for(int i=0;i<8;i++)
		cout<<setw(wid[i])<<title[i];
	cout<<endl;
    while(it!=data.end()){
		cout<<*it<<endl;
		it++;
	}
}
void CBrower::OnAverage(){
   double arv=0.0;
   vector<CStudent>::iterator it=data.begin();

   cout<<"姓名"<<"   "<<"平均成绩"<<endl;
   
    while(it!=data.end()){
		double sum=0;
		sum=it->comp_score + it->engl_score + it->math1_score + it->math_score + it->phys_score ;
		arv=sum/5.0;
		cout<<it->Name() <<" "<< arv <<endl;
	it++;

	}
}
void CBrower::OnScoreAnasys(){
double arv1=0.0;
double fc=0;
   vector<CStudent>::iterator it=data.begin();

   cout<<"姓名"<<"   "<<"主课成绩方差"<<endl;
   
    while(it!=data.end()){
		double sum1=0;
		sum1=it->comp_score + it->engl_score + it->math1_score + it->math_score + it->phys_score ;
		arv1=sum1/5.0;
		
		  fc=((*it)[3]-arv1)*((*it)[3]-arv1)+((*it)[4]-arv1)*((*it)[4]-arv1);

		cout<<it->Name() <<" "<< fc <<endl;
	it++;

	}
}
void CBrower::OnCredit(){
 int xf=0;
vector<CStudent>::iterator it=data.begin();
cout<<"姓名"<<"   "<<"总学分"<<endl;
while(it!=data.end()){
	if(it->comp_score>=60){
		xf=xf+4;
	}
	if(it->math1_score>=60){
		xf=xf+4;
	}
	if(it->phys_score>=60){
		xf=xf+4;
	}
		if( it->math_score>=60){
			xf=xf+7;
		}
		if(it->engl_score>=60){
			xf=xf+6;
		}
cout<<it->Name()<<"   "<<xf<<endl;
     xf=0;
     it++;
}
}

⌨️ 快捷键说明

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