数据结构课程设计 printf(\成功插入时间3!\\n\
printf(\在第%d位实验\\n\ } else {
printf(\输入错误,重新输入!\\n\ reserveLab(); } getch(); ControlLogic(); }
void getAnotherLab(int num) {
int studentNum=num; int LabNum = 0;
printf(\想插入哪个时间?(1 or 2 or 3): \ scanf(\ if (LabNum == 1) {
InGroupLab1(studentNum); printf(\成功插入时间1!\\n\
printf(\在第%d位实验\\n\ }
else if (LabNum == 2) {
InGroupLab2(studentNum); printf(\成功插入时间2!\\n\
printf(\在第%d位实验\\n\ }
else if (LabNum == 3) {
InGroupLab3(studentNum); printf(\成功插入时间3!\\n\
printf(\在第%d位实验\\n\ } else {
20
数据结构课程设计 printf(\输入错误,重新输入!\\n\ getAnotherLab(num); } getch(); ControlLogic(); }
void QueryConditon() {
int LabNum = 0;
printf(\想查询时间?(1 or 2 or 3): \ scanf(\ if (LabNum == 1) {
DispGroupLab1(); }
else if (LabNum == 2) {
DispGroupLab2(); }
else if (LabNum == 3) {
DispGroupLab3(); } else {
printf(\输入错误,重新输入!\\n\ QueryConditon(); } getch(); ControlLogic(); }
void PrintResult() {
DispGroupLab1(); DispGroupLab2(); DispGroupLab3(); getch(); ControlLogic();
21
数据结构课程设计 }
void ChangeReservation() {
int studentNum=0; int oldLab = 0; int deletFlg = 0; printf(\输入学号:\ scanf(\ printf(\
printf(\输入旧的时间(1 or 2 or 3):\ scanf(\ printf(\ if (oldLab == 1) {
deletFlg = deleteReservation1(studentNum); if (deletFlg == 1) {
printf(\已经退出时间1!\\n\ printf(\选择其它时间!\\n\ getAnotherLab(studentNum); } }
else if (oldLab == 2) {
deletFlg = deleteReservation2(studentNum); if (deletFlg == 1) {
printf(\已经退出时间2!\\n\ printf(\选择其它时间!\\n\ getAnotherLab(studentNum); } }
else if (oldLab == 3) {
deletFlg = deleteReservation3(studentNum); if (deletFlg == 1) {
printf(\已经退出时间3!\\n\ printf(\选择其它时间!\\n\ getAnotherLab(studentNum);
22
数据结构课程设计 } } else {
printf(\输入错误,重新输入!\\n\ ChangeReservation(); } getch(); ControlLogic(); }
int deleteReservation1(int studentNum) {
GroupLab1* nod = 0; GroupLab1* nodtemp = 0; int i = 0; int exsitFlg = 0;
if(pHeadLab1 == 0 || Size_GroupLab1 == 0) {
printf(\不在时间1中\\n\ return -1; }
else if(pHeadLab1 == pTailLab1 && Size_GroupLab1 == 1 && pHeadLab1->num == studentNum) {
pTailLab1 = 0; nod = pHeadLab1;
pHeadLab1 = pHeadLab1->next; i = nod->num; free(nod); Size_GroupLab1--; return 1; }
else if (Size_GroupLab1 > 1) {
nod = pHeadLab1;
for (i = Size_GroupLab1 ; i>0 ; i--) { if (nod->num == studentNum) { exsitFlg = 1;
23
数据结构课程设计 break; } else {
nod = nod->next; } }
if (exsitFlg == 1) {
if (i == Size_GroupLab1) {
pHeadLab1 = pHeadLab1->next; pHeadLab1->prev=0; } else if (i==1){
pTailLab1 = nod->prev; pTailLab1->next=0; } else {
nodtemp = nod->prev; nodtemp->next = nod->next; nod->next->prev = nodtemp; }/*nod->next->prev = nod->prev;*/ free(nod); Size_GroupLab1--; return 1; } else {
printf(\不在时间1中\\n\ return -1; } } else {
printf(\不在时间1中\\n\ return -1; } }
int deleteReservation2(int studentNum) {
GroupLab2* nod = 0; GroupLab2* nodtemp = 0; int i = 0; int exsitFlg = 0;
if(pHeadLab2 == 0 || Size_GroupLab2 == 0) {
24
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库物理实验管理程序设计(5)在线全文阅读。
相关推荐: