?? insert.cpp
字號:
#include"head.h"
#include<iostream.h>
#include<stdlib.h>
extern void InitScore(Student*);
extern void InputDisplay(Student*);
void Insert(Student* &head)
{
Student*pGuard;
Student*pS;
char choice;
choice='y';
while(choice=='y'||choice=='Y')
{
pS=new Student;
InitScore(pS);
pS->next=NULL;
InputDisplay(pS);
status1:
cout<<"請核對以上信息,輸入內容完全無誤嗎?(y/n)";
cin>>choice;
if(choice=='n'||choice=='N')
{
cout<<"那么請重新輸入吧."<<endl;
system("pause");
system("cls");
InputDisplay(pS);
goto status1;
}
else if(choice!='y'&&choice!='Y'&&choice!='n'&&choice!='N')
{
cout<<"您鍵入的內容有錯,請重新選擇."<<endl;
goto status1;
}
if(head==NULL)
{
head=pS;
}
else
{
for(pGuard=head;pGuard->next!=NULL&&pGuard->next->Class<pS->Class;pGuard=pGuard->next)
;
if(pGuard==head&&pGuard->Class>pS->Class)
{
head=pS;
pS->next=pGuard;
}
else if(pGuard==head&&pGuard->Class<pS->Class)
{
pS->next=head->next;
head->next=pS;
}
else
{
pS->next=pGuard->next;
pGuard->next=pS;
}
}
system("cls");
status2:
cout<<"還要輸入下一個學生信息的嗎?(y/n)";
cin>>choice;
if(choice!='y'&&choice!='Y'&&choice!='n'&&choice!='N')
{
cout<<"您鍵入的內容有錯,請重新選擇."<<endl;
goto status2;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -