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

📄 teacher.cpp

📁 程序功能: 1 管理员开设课程; 2 学生可以选择课程; 3 学生注册; 4 教师注册; 5 教师给选自己课程的学生给成绩; 6 管理员对学生成绩进行管理; 7 学生能够查询通过密码自己
💻 CPP
字号:

//teacher.cpp
#include"teacher.h"
int teacher::tcount=0;
teacher::teacher()
{

	next=NULL;
	name[0]='0';
	
	
}
teacher::~teacher()
{
	if (next != NULL)
		
		delete next;
}
/*************************************
 * 设置函数
 ************************************/
void teacher::tecset(teacher *a,course *topco)
{
	a->flage=1;
	cout<<"\t姓名(以'Q'结束): "<<flush;
	gets(a->name);
	if(a->name[0]=='Q')
	{
		a->flage=0;
		return;
	}
   /* printf("\t设置密码:");
    a->pwt.set();*/
    int f=0;
	cout<<"\t选择课程号:";
	cin>>f;
course *pc;
pc=topco;
while(pc!=NULL)
			{
			  if(pc->Getno()==f)
			  {
			  a->co.SetCourse(pc->Getname(),pc->Getroom(),pc->Getno(),pc->Getpeo(),
			  pc->GetCredit());
			  cout<<"\t你任教“"<<a->co.Getname()<<"”课"<<endl;
			  break;
			  }
			  pc=pc->Getnext();
			}
			
		
}

void teacher::tecdisplay(teacher *a)
{
	cout<<a->name<<'\t'<<a->co.Getname()<<endl;
}

teacher *teacher::teclist(teacher *topt,course*topco)
{
	teacher *p,*star;
	star=topt;
	topt->next=star;
	while(1)
{
		p=new teacher;
		tecset(p,topco);
		if(p->flage==0)
break;
		star->next=p;
		star=p;
	};
	star->next=NULL;
	return topt;
}
/*************************************
 * 给成绩函数
 ************************************/
void teacher::GiveScore(teacher*topt,Student*p1)
{
  if(topt->next==NULL)
	return;
Student *p=p1;           
teacher *t=topt;
t=t->next;
while(t!=NULL)
	{
		  /*cout<<"\t"<<t->name<<"老师请给"<<t->co.Getname()<<"成绩"<<endl;
		  printf("\t输入密码:");//用cout有缓冲问题 
          password pwc;
       	  pwc.set();
		  if(strcmp(pwc.Getp(),t->pwt.Getp())==0)
		  { */
		   while(p!=NULL)
		   {
	           int j=0;
               course *reco;
			   reco=p->Getco();
		       while(j<5)
				 {
                    
				   if((strcmp(reco[j].Getname(),t->co.Getname()))==0)
					{
							cout<<"\t学号:"<<p->Getno()<<endl;
                            cout<<"\t姓名:"<<p->Getna()<<endl;
							while(1)
							{
							 cout <<'\t'<<reco[j].Getname()<< ":" << flush;
							 double m=0.0;
							 cin>>m;
							 if(m <=100&&m >=0)
							 {  
								 reco[j].SetScore(m);
								 cout<<reco[j].Getscore()<<endl;
								 break;
							 }
							 else cout<<"\tenter error!please enter again!"<<endl;
                             
							}
                         break;
						}
							j++;
				 }	
                    p=p->Getnext();
				
				}
		 /* }
			else cout<<"密码错!"<<endl;*/
		    t=t->next;
	        p=p1;
	  }

}

⌨️ 快捷键说明

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