資源簡介
大一時的課設,很完整的C++成績管理系統,VC6.0做的。值得看看哦
代碼片段和文件信息
#include?“stdafx.h“
#include“fun.h“
#include
#include
#include
#include
#include
#include?
using?namespace?std;
extern?CManageStudent*pbase;
int?&?CStudent::ID(){
return?_ID;
}
int&?CStudent::SN(){
return?SequenceNumber;
}
string&?CStudent::Name(){
return?name;
}
int&?CStudent::operator[](int?index){
switch(index)
{
case?0:
return?math_score;
break;
case?1:
return?phys_score;
break;
case?2:
return?math1_score;
break;
case?3:
return?comp_score;
break;
case?4:
return?engl_score?;
break;
default:
throw?“You?must?give?the?index?no?big?than?4?and?no?less?than?0!“;
break;
}
}
CCredit::CCredit():math(7.0)phys(4.0)comp(4.0)math1(4.0)engl(6.0){}
double&?CCredit::operator[](int?index){
switch(index)
{
case?0:
return?math;
break;
case?1:
return?phys;
break;
case?2:
return?math1;
break;
case?3:
return?comp;
break;
case?4:
return?engl?;
break;
default:
throw?“You?must?give?the?index?no?big?than?4?and?no?less?than?0!“;
break;
}
}
ostream&operator<<(ostream&osconst?CStudent&st)
{
CStudent?obj=st;
os< os< os< os< os< os< os< os< return?os;
}
vector?CManageStudent::data;
string?CManageStudent::title[8]={“學號“?“序號““姓名““高等數學“?“普通物理“?“離散數學“?“計算機““英語“};
int?CManageStudent::wid[8]={116899986};
void?CManageStudent::ShowMenu(){
cout< cout<<“*******************學生成績管理系統***************************\n“;
cout<<“1?預覽\t2?查找\t3?添加\t4?刪除\t5?更改\t6?排序\t7?保存\t0?退出\n“;
cout<<“**************************************************************\n“;
}
void?CManageStudent::OnBrower(){
pbase=new?CBrower;
}
void?CManageStudent::OnFind()
{
pbase=new?CFind;
}
void?CManageStudent::OnInvalidateInput(char*str){
cout< }
bool?CManageStudent::InitialData()//變量data進行初始化
{
ifstream?fin(“score.txt“);
if(fin.fail()){
cout<<“找不到數據文件“< return?false;
};
string?s;//定義一個讀取文件每一行的string對象
getline(fins);//將標題行讀出,不用
while(getline(fins)){
istringstream?istr(s);
CStudent?st;
istr>>st.ID()?;
istr>>st.SN()?;
istr>>st.Name()?;
for(int?i=0;i<5;i++)
istr>>st[i]?;
data.push_back(st);
}
fin.close();
return?true;
}
void?CManageStudent::OnAddData()
{
char?ch;
do{
CStudent?st;
st.ID()=data[data.size?()-1].ID()?;
st.ID()++;
st.SN()?=data[data.size()-1].SN()?;
st.SN()++;
cout<<“請輸入學生姓名:“;
cin>>st.Name();
for(int?i=0;i<5;i++)
{
cout<<“請輸入“<tle[i+3];//高等數學成績:“;
cin>>st[i];
}
cout<<“輸入正確嗎?y表示確定;r表示重新輸入;n表示放棄\n“;
cin>>ch;
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????12510??2008-01-12?11:45??我的學生系統\fun.cpp
?????文件???????1269??2007-10-30?09:12??我的學生系統\score.txt
?????文件???????1969??2008-01-12?10:14??我的學生系統\fun.h
?????文件??????48640??2008-01-12?13:58??我的學生系統\我的學生系統.opt
?????文件????????667??2008-01-08?10:10??我的學生系統\StdAfx.h
?????文件????????299??2008-01-08?10:10??我的學生系統\StdAfx.cpp
?????文件???????1244??2008-01-08?10:10??我的學生系統\ReadMe.txt
?????文件????????549??2008-01-08?10:10??我的學生系統\我的學生系統.dsw
?????文件??????58368??2008-01-12?13:58??我的學生系統\我的學生系統.ncb
?????文件?????107520??2008-01-12?13:56??我的學生系統\Debug\vc60.idb
?????文件?????187196??2008-01-08?10:42??我的學生系統\Debug\我的學生系統.pch
?????文件?????159744??2008-01-12?11:45??我的學生系統\Debug\vc60.pdb
?????文件???????2166??2008-01-08?10:42??我的學生系統\Debug\StdAfx.obj
?????文件?????181140??2008-01-12?10:14??我的學生系統\Debug\我的學生系統.obj
?????文件?????514001??2008-01-12?11:45??我的學生系統\Debug\fun.obj
?????文件?????912692??2008-01-12?11:45??我的學生系統\Debug\我的學生系統.ilk
?????文件?????651368??2008-01-12?11:45??我的學生系統\Debug\我的學生系統.exe
?????文件????1418240??2008-01-12?11:45??我的學生系統\Debug\我的學生系統.pdb
?????文件???????1388??2008-01-12?11:45??我的學生系統\我的學生系統.plg
?????文件???????4728??2008-01-08?15:16??我的學生系統\我的學生系統.dsp
?????文件????????388??2008-01-08?17:07??我的學生系統\我的學生系統.cpp
?????目錄??????????0??2008-01-08?10:10??我的學生系統\Debug
?????目錄??????????0??2008-01-08?10:10??我的學生系統
-----------?---------??----------?-----??----
??????????????4266086????????????????????23
評論
共有 條評論