⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 create.cpp

📁 学校的教学管理系统
💻 CPP
字号:
#include"head.h"
#include<iostream.h>
#include<stdlib.h>

extern void InputDisplay(Student*);
extern void InitScore(Student*);     //初始化每个节点的所有成绩记录为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<<"下面请按照提示录入各班学生的信息:"<<endl;

	system("pause");
	system("cls");


	while(choice=='Y'||choice=='y')
	{
		pS=new Student;
		InitScore(pS);
		pS->next=NULL;
		InputDisplay(pS);

status1:
		cout<<"请核对以上信息,输入内容完全无误吗?  (y/n):"<<endl;
		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
		{
			pGuard->next=pS;
		}
		pGuard=pS;
		system("cls");

status4:
		cout<<"还要输入下一个学生的信息吗?  (y/n):";
		cin>>choice;
		if(choice!='y'&&choice!='Y'&&choice!='n'&&choice!='N')
		{
			cout<<"您键入的内容有错,请重新选择."<<endl;
			goto status4;
		}
	}
	
	SortByClass(head);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -