資源簡介
該課設具是以c++語言來編寫的作業(yè)管理系統(tǒng)。能查看學生作業(yè)信息

代碼片段和文件信息
#?include?
#?include?
#?include?
using?namespace?std;
struct?SCORE???????????????//定義存放學生成績信息的結(jié)點
{
????int?num;???????????????//作業(yè)編號
string?content;???????????//作業(yè)內(nèi)容
string?name;????????????//姓名
int?id;?????????//學號
float?score;????????//就算計基礎成績
float?scoresum;????????//總成績
struct?SCORE?*?next;???//next為指向下一結(jié)點的指針
};
struct?SCORE?*?head;???????//指向鏈表頭結(jié)點的指針
int?studentSum=0;??????????//學生總?cè)藬?shù)
class?record
{
public:
????struct?SCORE?*?InsertRecord(struct?SCORE?*?h);????????//增加學生成績信息
struct?SCORE?*?DeleteRecord(struct?SCORE?*?h);????????//刪除學生成績信息
struct?SCORE?*?UpdateRecord(struct?SCORE?*?h);????????//修改學生成績信息
????void?FindRecord(struct?SCORE?*?hint?xfloat?s1float?s2);????//根據(jù)作業(yè)分數(shù)分數(shù)段查詢學生成績信息
void?FindRecord(struct?SCORE?*?hstring?x);???????????//根據(jù)學生姓名查詢成績信息
void?FindRecord(struct?SCORE?*?hint?x);??????????????//根據(jù)學生學號查詢成績信息
void?FindRecord(struct?SCORE?*?hint?ffloat?x);??????????????//根據(jù)作業(yè)編號查詢成績信息
void?PrintRecord(struct?SCORE?*?h);???????????????????//輸出所有學生成績信息
void?SaveRecordFile(struct?SCORE?*?h);????????????????//保存學生成績信息到文件
struct?SCORE?*?LoadRecordFile(struct?SCORE?*?h);??????//從文件中加載學生成績信息
};
struct?SCORE?*?record::InsertRecord(struct?SCORE?*?h)
{
????struct?SCORE?*?p1*p2*p3;????????????????//定義指針變量p1、p2、p3
p3=new?SCORE;?????????????????????????????//創(chuàng)建新的學生成績結(jié)點
cout<<“\n請輸入學生學號:“;
cin>>p3->id;?????????????????????????????//從鍵盤接收輸入數(shù)賦值給結(jié)點的學號
cout<<“\n請輸入學生姓名:“;
cin>>p3->name;????????????????????????????//從鍵盤接收輸入數(shù)賦值給結(jié)點的姓名
cout<<“\n請輸入作業(yè)編號:“;
cin>>p3->num;????????????????????????????//從鍵盤接收輸入數(shù)賦值給結(jié)點的數(shù)學成績
cout<<“\n請輸入學生作業(yè)內(nèi)容:“;
cin>>p3->content;?????????????????????????//從鍵盤接收輸入數(shù)賦值給結(jié)點的英語成績
cout<<“\n請輸入學生的作業(yè)分數(shù):“;
cin>>p3->score;????????????????????????//從鍵盤接收輸入數(shù)賦值給結(jié)點的計算機成績
p3->next=NULL;????????????????????????????//將要插入結(jié)點的指針域設置為空
if(h==NULL)???????????????????????????????//當鏈表中沒有結(jié)點時,將要加入的結(jié)點作為頭結(jié)點
{
????????h=p3;
return?h;
}
p1=p2=h;
while(p1!=NULL)??????????//查找結(jié)點的學號大于要插入結(jié)點學號的第一個結(jié)點
??????????????????????????????????????//指針p1表示符合條件的結(jié)點的指針,指針p2是指針p1的前一個結(jié)點指針
{
p2=p1;
p1=p1->next;?
}
if(p1==h)?????????????????????????????????//插入位置為頭結(jié)點前
{
p3->next=p3;
h=p3;
return?h;
}
else??????????????????????????????????????//插入位置為鏈表中間和鏈表尾部
{
p2->next=p3;
p3->next=p1;
}
studentSum+=1;????????????????????????????//學生人數(shù)加1
return?h;????}
void?record::PrintRecord(SCORE?*?h)
{
????if(h==NULL)
{
cout<<“\n抱歉,沒有任何記錄!\n“;
return;
}
cout<<“\n學號\t姓名\t作業(yè)編號\t作業(yè)內(nèi)容\t作業(yè)分數(shù)“< while(h)??????????????????????????????????//輸出鏈表中每個結(jié)點的學生成績信息
{
cout<id<<“\t“<name<<“\t“<num<<“\t“<content<<“\t“<score<<“\t“< h=h->next;
}
}
struct?SCORE?*?record::DeleteRecord(struct?SCORE?*?h)
{
????struct?SCORE?*?p1*?p2;
int?id;
if(h==NULL)??????????????????????????????????//鏈表為空
{
cout<<“\n抱歉,沒有任何記錄!“;
return?h;
}
p1=p2=h;?????????????????????????????????????//將鏈表
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????12333??2019-03-05?13:45??作業(yè)管理\ss.cpp
?????目錄???????????0??2019-03-31?16:19??作業(yè)管理\
- 上一篇:帶蹩馬腿功能的馬踏棋盤
- 下一篇:SLE4442驅(qū)動源碼
評論
共有 條評論