资源简介
给出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 < 0 || 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 < position; 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 < current->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 统计成绩\sc
文件 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
相关资源
- VisualStudioUninstaller vs卸载工具
- 组态王驱动开发包3.0.0.7(中文)
- 多窗口后台鼠标连点器
- 使用选择性重传协议实现UDP可靠通信
- 数据结构年终考题范围和答案 耿国华
- 数据结构 朱战力 习题解答 数据结构
- VC 获得文件属性 获取文件的创建时
- 读者写者问题(读者优先,写者优先
- 数据结构课程设计 6 1 彩票系统
- 用VC 编写的仿QQ聊天室程序源代码
- 教学计划编制系统
- 大数(链表、数组)实现
- 外点法程序
- 外罚函数程序
- qt-电子点菜系统
- 推箱子及人工智能寻路C 源代码
- 自己写的航空订票系统c 版--数据结构
- 数据结构实验魔王语言
- MUSIC算法c 实现
- C 餐厅叫号系统(QT平)
- 国际象棋c 完整版
- 航空订票系统_数据结构课程设计
-
ob
jectARX给Auto CAD加工具条 - 画图程序MFC/VC/VC CRectTracker 串行化
- MFC网络编程实例
- c 课程设计 职工信息管理系统
- VC 游戏编程—附源代码
- IpHlpApi.h&IpHlpApi.lib
- 清华大学 c 郑莉 ppt课件
- c 程序判断离散数学中命题公式
评论
共有 条评论