?? create.cpp
字號(hào):
#include"head.h"
#include<iostream.h>
#include<stdlib.h>
extern void InputDisplay(Student*);
extern void InitScore(Student*); //初始化每個(gè)節(jié)點(diǎn)的所有成績(jī)記錄為0
extern void SortByClass(Student* &);
void Create(Student* &head)
{
Student *pS;
Student *pEnd;
Student *pGuard;
char choice='y';
pS=new Student;
InitScore(pS);
pS->next=NULL;
pEnd=pS;
cout<<"下面請(qǐng)按照提示錄入各班學(xué)生的信息:"<<endl;
system("pause");
system("cls");
while(choice=='Y'||choice=='y')
{
pS=new Student;
InitScore(pS);
pS->next=NULL;
InputDisplay(pS);
status1:
cout<<"請(qǐng)核對(duì)以上信息,輸入內(nèi)容完全無(wú)誤嗎? (y/n):"<<endl;
cin>>choice;
if(choice=='N'||choice=='n')
{
cout<<"那么請(qǐng)重新輸入吧."<<endl;
system("pause");
system("cls");
InputDisplay(pS); //注意,這里也應(yīng)該有一個(gè)判斷輸入正確與否的語(yǔ)句
goto status1; //暫且用這個(gè)
}
else if(choice!='Y'&&choice!='y'&&choice!='N'&&choice!='n')
{
cout<<"您鍵入的內(nèi)容有錯(cuò),請(qǐng)重新選擇."<<endl;
goto status1;
}
if(head==NULL)
{
head=pS;
}
else
{
pGuard->next=pS;
}
pGuard=pS;
system("cls");
status4:
cout<<"還要輸入下一個(gè)學(xué)生的信息嗎? (y/n):";
cin>>choice;
if(choice!='y'&&choice!='Y'&&choice!='n'&&choice!='N')
{
cout<<"您鍵入的內(nèi)容有錯(cuò),請(qǐng)重新選擇."<<endl;
goto status4;
}
}
SortByClass(head);
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -