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

資源簡介

實(shí)現(xiàn)一個(gè)學(xué)生管理系統(tǒng),即定義一個(gè)包含學(xué)生信息(學(xué)號,姓名,成績)的順序表,可以不考慮重名的情況,系統(tǒng)包含以下功能: (1) 根據(jù)指定學(xué)生個(gè)數(shù),逐個(gè)輸入學(xué)生信息; (2) 逐個(gè)顯示學(xué)生表中所有學(xué)生的相關(guān)信息; (3) 給定一個(gè)學(xué)生信息,插入到表中指定的位置; (4) 刪除指定位置的學(xué)生記錄; (5) 統(tǒng)計(jì)表中學(xué)生個(gè)數(shù); (6) 利用直接插入排序或者折半插入排序按照姓名進(jìn)行排序; (7) 利用快速排序按照學(xué)號進(jìn)行排序; (8) 根據(jù)姓名進(jìn)行折半查找,要求使用遞歸算法實(shí)現(xiàn),成功返回此學(xué)生的學(xué)號和成績; (9) 根據(jù)學(xué)號進(jìn)行折半查找,要求使用非遞歸算法實(shí)現(xiàn),成功返回此學(xué)生的姓名和成績。

資源截圖

代碼片段和文件信息

#include
#include
#include
#define?MAXSIZE?21?????//能容納的最大學(xué)生數(shù)

typedef?struct{
int?no;????//學(xué)號
char?name[30]; //姓名
double?score; //成績
}Student;

typedef??struct?{
??Student??*stu;?????//指向數(shù)據(jù)元素的基地址
??int??length;???????//線性表的當(dāng)前長度???????????????????????????????????????????????????????????
?}SqList;

//錄入學(xué)生信息
void?input(SqList?&L){
cout?< int?n;
cin?>>?n;
while(n?>?20?||?n? cout?< cout?< cin?>>?n;
}
L.stu?=?new?Student[MAXSIZE];
L.length?=?n;

for(int?i?=?1?;?i?<=?n?;?i++){
cout?< cout?< cin?>>?L.stu[i].name;
cout?< cin?>>?L.stu[i].no;
cout?< cin?>>?L.stu[i].score;
}
cout?< cout?<}

void?output(SqList?L){
cout?< cout?< for(int?i?=?1?;?i?<=?L.length?;?i++){
cout?< cout?< }
cout?<}

//判斷學(xué)生學(xué)號是否相同
int?judge(int?n??SqList?L){
for(int?i?=?1?;?i?<=?L.length?;?i++){
if(n?==?L.stu[i].no)
return?1;
}
return?0;
}

//插入學(xué)生
void?insert(SqList?&L){
int?num?=?L.length;

if(num?==?MAXSIZE){
cout?< exit(1);
}

Student?s;
int?n;
cout?< cin?>>?n;
while(n??(num?+?1)){
cout?<<“對不起,輸入的位置有誤,請重新輸入!“< cout?< cin?>>?n;
}

cout?< cin?>>?s.no;
int?flag1?=?judge(s.no??L);
while(flag1){
cout?< cout?< cin?>>?s.no;
flag1?=?judge(s.no??L);
}
cout?< cin?>>?s.name;
cout?< cin?>>?s.score;

for(int?i?=?num?;?i?>=?n?;?i--)
L.stu[i?+?1]?=?L.stu[i];
L.stu[n]?=?s;
L.length++;
}

//刪除學(xué)生
void?deletestu(SqList?&L){
int?num?=?L.length;
if(num?==?0){
cout?< exit(1);
}
int?n;
cout?< cin?>>?n;
while(n??num){
cout?<<“對不起,刪除的位置有誤,請重新輸入!“< cout?< cin?>>?n;
}

char?ch;
cout?< cout?< cin?>>?ch;
while(ch?!=?‘Y‘?&&?ch?!=?‘y‘?&&?ch?!=?‘N‘?&&?ch?!=?‘n‘){
cout?< cout?< cin?>>?ch;
}
if(ch?==?‘Y‘?||?ch?==?‘y‘){
for(int?i?=?n;?i?<=?num;?i++)
L.stu[i]?=?L.stu[i?+?1];
L.length--;
cout?< }
else
cout?<}

//統(tǒng)計(jì)表中學(xué)生的個(gè)數(shù)
void?Length(SqList?L){
cout?< cout?<}

//利用折半插入排序按照姓名進(jìn)行排序
void?Sort_Name(SqList?&L){
int?len?=?L.length;
for(int?i?=?2?;?i?<=?len?;?i+

評論

共有 條評論

相關(guān)資源