91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

給出n個學生的m門考試的成績表,每個學生的信息由學號、姓名以及各科成績組成。對學生的考試成績進行有關統計,并打印統計表。對此我們先假定學生共有四門課程分數:語文、數學、英語及數據結構成績。

資源截圖

代碼片段和文件信息

#include“List.h“


List::List()
{
count?=?0;
head?=?NULL;
}

List::~List()
{
????student?*p?*q;

p?=?head;

for(int?i?=?0;i?!=?count;i?++)
{
q?=?p->next;

delete?p;

p?=?q;
}
count?=?0;
head?=?NULL;
}

Error_code?List::insert(int?position?const?std::string?nam?const?std::string?num?
???const?int?Chi?const?int?math?const?int?Eng?const?int?data)
{
???if?(position??count)
??????return?range_error;
???student?*new_student?*previous?*following;
???if?(position?>?0)?
???{
??????previous?=?set_position(position?-?1);
??????following?=?previous->next;
???}
???else?
???following?=?head;
???new_student?=?new?student(nam?num?Chi?math?Eng?data?following);
???if?(new_student?==?NULL)
??????return?overflow;
???if?(position?==?0)
??????head?=?new_student;
???else
??????previous->next?=?new_student;
???count++;
???return?success;
???
}

student*?List::set_position(int?position)?const
{
???student?*q?=?head;
???for?(int?i?=?0;?i????{
???q?=?q->next;
???}
???return?q;
}

void??List::insertion_sort()
{
student??*first_unsorted
?????*last_sorted
?*current
?*trailing;
if(head!=NULL)
{
last_sorted?=?head;
int?n?=?this->count;
for(int?i=1?;i {
first_unsorted?=?last_sorted->next;
if(first_unsorted->total?>?head->total)
{
//?Insert?*first_unsorted?at?the?head?of?the?sorted?list:
last_sorted->next?=?first_unsorted->next;
first_unsorted->next?=?head;
head?=?first_unsorted;
}
else
{
????????????????trailing?=?head;
current?=?trailing->next;
//?Search?the?sorted?sublist?to?insert?*first_unsorted:
while(first_unsorted->total?total){
????????trailing?=?current;
current?=?trailing->next;
}
//?*first_unsorted?now?belongs?between?*trailing?and?*current
if(first_unsorted==current)
last_sorted?=?first_unsorted;????//?already?in?right?position
???? else
{
last_sorted->next?=?first_unsorted->next;
first_unsorted->next?=?current;
trailing->next?=?first_unsorted;
}
}
}
}
}







void?List::traverse(void?(*visit)(std::string?&numstd::string??&name?int?&total?int?&chineseint?&math?int?&english?int?&datastr))
{
???student?*q;
???
???q?=?head;

???for?(int?i?=?0;i?!=?count;i?++)
???{
??????(*visit)(q->numberq->nameq->totalq->Chineseq->Mathq->Englishq->DataStruction);
??q?=?q->next;
???}

}



?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????39202??2012-06-13?22:21??統計成績\Debug\List.obj

?????文件?????266686??2012-06-13?19:30??統計成績\Debug\main.obj

?????文件??????35238??2012-06-13?19:30??統計成績\Debug\student.obj

?????文件?????156672??2012-06-13?22:21??統計成績\Debug\vc60.idb

?????文件?????135168??2012-06-13?22:21??統計成績\Debug\vc60.pdb

?????文件?????557140??2012-06-13?22:21??統計成績\Debug\統計成績.exe

?????文件?????808072??2012-06-13?22:21??統計成績\Debug\統計成績.ilk

?????文件????2058988??2012-06-13?22:21??統計成績\Debug\統計成績.pch

?????文件????1426432??2012-06-13?22:21??統計成績\Debug\統計成績.pdb

?????文件???????2532??2012-06-13?22:20??統計成績\List.cpp

?????文件????????558??2012-06-13?22:21??統計成績\List.h

?????文件???????2094??2012-06-13?19:30??統計成績\main.cpp

?????文件????????411??2012-06-13?19:30??統計成績\resource.h

?????文件???????2566??2012-06-13?19:30??統計成績\script1.rc

?????文件????????327??2012-06-13?19:30??統計成績\student.cpp

?????文件????????494??2012-06-13?19:30??統計成績\student.h

?????文件??????????0??2012-06-13?19:30??統計成績\utility.asp

?????文件????????193??2012-06-13?19:30??統計成績\utility.h

?????文件???????4606??2012-06-13?19:30??統計成績\統計成績.dsp

?????文件????????524??2012-06-13?19:30??統計成績\統計成績.dsw

?????文件??????82944??2012-06-13?22:21??統計成績\統計成績.ncb

?????文件??????50688??2012-06-13?22:21??統計成績\統計成績.opt

?????文件???????1338??2012-06-13?22:21??統計成績\統計成績.plg

?????目錄??????????0??2012-06-13?22:21??統計成績\Debug

?????目錄??????????0??2012-06-13?22:21??統計成績

-----------?---------??----------?-----??----

??????????????5632873????????????????????25


評論

共有 條評論