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

📄 lesson.cpp

📁 学生管理类,很好的
💻 CPP
字号:
// Lesson.cpp: implementation of the Lesson class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include <iostream.h>
#include <conio.h> 
#include "lesson.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

Lesson::Lesson()
{
    int s;
	first=NULL;
	last=NULL;
	
	while(1)
	{
		creatLesson();
		cout<<"Do you want to Input The Next Lesson?"<<endl
			<<"1)yes     2)no       ***input your choice  ";
		cin>>s;
		if(s==1);
		else if (s==2) break;
		else {cout<<"your choice was error!!"<<endl; break;}
	}
}

}

Lesson::~Lesson()
{

}
void Lesson::creatLesson()
{	
	int banN,teacN;
	cout<<"who teach which class?"<<endl;
	cout<<"Input the Teacher's Number:  ";
	cin>>teacN;
	cout<<"Input the Class's Number:  ";
	cin>>banN;
	cout<<endl;

	lesson_node *newnode=new lesson_node(banN,teacN);
	if(first==NULL)  first=newnode; 
	else last->next=newnode;
	last=newnode;


}
void Lesson::showLesson()
{
	int sign=1;
	if(first!=NULL)
	{
		iterator=first;
		cout<<endl;
		while(1)
		{
			cout<<sign++<<") "<<"Teacher "<<iterator->teacNum<<" teach class "<<iterator->banNum<<endl;
			if(iterator==last) break;
			else iterator=iterator->next;

		}
	}
	else return;
	
}
	

void Lesson::chgLesson()
{
	showLesson();
	int sign=0;
	cout<<"Input the Lesson Number you want to change :  ";
	cin>>sign;
	iterator=first;
	while(1)
	{
		if(sign==0||iterator==NULL) cout<<"error"<<endl;
		else if (sign==1) 
		{
			cout<<"Input the New Teacher's Number:  ";
			cin>>iterator->teacNum;
			cout<<"Input the New Class's Number:  ";
			cin>>iterator->banNum;
			break;
		}
		else 
		{
			iterator=iterator->next;
			sign--;
		}
	}
}




⌨️ 快捷键说明

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