请问一下大神们这个要怎么运行呀!!

#include"stdafx.h"
#include <iostream> 
#include <fstream> 
#include <vector>
#include <algorithm>
#include <cstring> 
#include <string>
using namespace std;

class CPerson
{
private:
    string name;
    int age;
    char sex;
public:
    CPerson()
     {}
    CPerson(string name,int age=0,char sex='M')
{
    this->name=name;
    this->age=age;
    this->sex=sex;
}
void SetAge(int age=0)
{
    this->age=age;
}
void SetNameAndSex(string name,char sex)
{
    this->name=name;
    this->sex=sex;
}
void ShowInfo()
{
   cout<<name<<"\t"<<age<<"\t"<<(sex=='M'?"男":"女")<<endl;
}
string GetName()
{
    return name;
}
int GeAge()
{
    return age;
}
char GetSex()
{
    return sex;
}
};

class CTeacher:public CPerson
{
    private:
        string title;   ||职称
        string teano;   ||职工号
        vector<string> course;   ||教授课程
        float score;     ||教学效果综合评分
    public:
        CTeacher()
         {}
         CTeacher(string name,int age=0,char sex='M'):CPerson(name,age,sex)
         {}
void SetData(string title,string teano)
{
    this->title=title;
    this->teano=teano;
}
void SetCourse(string c1,string c2,string c3)
{
    course.push_back(c1);
    course.push_back(c2);  
    course.push_back(c3); 
}
void SetScore(float score)
{
    this->score=score;
}
void ShowInfo()
{
cout<<teano<<"\t"<<GetName()<<"\t"<<GetAge()<<"\t"<< (GetSex()=='M'?"男":"女")<<title<<"\t"<course[0]<<"\t"<<course[1]<<"\t"<<course[2]<<"\t"<<score<<endl;
}
void operator=(CTeacher &one)
{
CPerson(one.GetName(),one.GetAge(),one.GetSex());
this->title=one.title;
this->teano=one.teano;
this->course[0]=one.course[0];
this->course[0]=one.course[1];
this->course[0]=one.course[2];
this->score=one.score;
}
vector<string> GetCourse()
{
    return course;
}
string GetTitle()
{
    return title;
}
string GetTeano()
{
    return teano;
}
float GetScore()
{
    return score;
}
};
class CNode
{
friend class CList;
private:
    CTeacher data;
    CNode *next;
};
class CList
{
    private:
        CNode *head;
        CNode *tail;
        CNode *p;
        CNode *pre;
        int num;   ||当前节点数
public:
    int MainMenu()
    {
            cout<<"1.显示当前记录"<<endl;
            cout<<"2.添加记录"<<endl;
            cout<<"3.排序"<<endl;
            cout<<"4.查找"<<endl;
            cout<<"5.创建新纪录"<<endl;
            cout<<"0.退出"<<endl;
			cot<<endl;
            int choice;
            cin>>choice;
            return choice
}
void MainMenuControl()
{
ReadData();
while(1)
{
int choice=MainMenu();
if(choice==0) break;
switch(choice)
{
case 1:Print();                         break;
case 2:Append();                        break;
case 3:SortMennuCortrol();              break;
case 4:SearchMenuCortrol();             break;
case 5:NewList();                       break;
}
}
cout<<"是否保存?(Y/N):";
char c; 
cin>>c;
if(c=='y') Save();
}
void ReadData()
{
head=tail=new CNode;
head->next=NULL;
num=0;
char fname[80];
cout<<"请输入要读取的文件:";
cin>>fname;
ifstream file(fname);
if(!file)
{
    cout<<"出现未知错误导致无法打开!"<<endl;
    exit(1);
}
string name,title,teano,course[3];
int age;
char sex;
float score;
while (file.peek()!=EOF)
{
file>>teano>>name>>age>>sex>>title>>course[1]>>course[2]>>score;
p=new CNode;
p->data.SetNameAndSex(name,sex);
p->data.SetAge(age);
p->data.Data(title,teano);
p->data.Course(course[0],course[1],course[2]);
p->data.SetScore(score);
tail->next=p;
tail=p;
num++;
}
tail->next=NNULL;
}
void Print()
{
for(p=head->next,p!=NULL;p=p->next)
p->data.ShowInfo();
cout<<endl;
}
void Append()
{
while(1)
{
p=new CNode;
cout<<"请输入:"<<endl;
cout<<":";
string name;
cin>>name;
cout<<"年龄:";
int age;
cin>>age;
cout<<"性别(F/M):";
char sex;
cin>>sex;
p->data.SetNameAndSex(name,sex);
p->data.SetAge(age);
cout<<"职称:";
string title;
cin>>title;
cout<<"职工号:";
string teano;
cin>>teano;
p->data.SetData(title,teano);
cout<<"教授课程:";
string course[3];
cin>>course[0]>>course[1]>>course[2];
cout<<"教学效果评分:";
float score;
cin>>score;
p->data.SetScore(score);
p->next=tail->next;
tail->next=p;
tail=p;
num++;
char c;
cout<<"是否继续添加?(Y/N):";
cin>>c;
cin get();
if(c!='y') break;
}
tail->next=NULL;
Print();
}
int SortMenu()
{
cout<<"1.按职工号排序"<<endl;
cout<<"2.按教学效果综合评分排序"<<endl;
cout<<"0.退出"<<endl;
cout<<endl;
int choice;
cin>>choice;
return choice;
}
void SortMenuCortrol()
{
while(1)
{
int chioce=SortMenu();
if(chioce==0) break;
switch(choice)
{
case 1:SortByTeano(); break;
case 2:SortByScore();  break;
}
Print();
}
}
void InsertByTeano(CNode *newp)
{
for (pre=head,p=head->next,p!=NULL;pre=p,p=p->next)
if(newp->data.GetTeano()<p->data.GetTeano()) break;
newp->next=p;
pre->next=newp;
}
void SortByTeano()
{
p=head->next;
head->next=NULL;
CNode *nextp;
}
void SortByTeano()
{
p=head->next;
head->next=NULL;
CNode *nextp;
while (p!=NULL)
{
nextp=p->next;
InsertByTeano(p);
p=nextp;
}
}
void InsertByScore(CNode *newp)
{
for(pre=head,p=head->next,p!=NULL;pre=p,p=p->next)
if(newp->data.GetScore()<p->data.GetScore()) break;
newp->next=p;
pre->next=newp;
}
void SortByScore();
{
p=head->next;
head->next=NULL;
CNode *nextp;
while (p!=NULL)
{
nextp=p->next;
InsertByScore(p);
p=nextp;
}
}
int SearchMenu()
{
cout<<"1.按姓名查找"<<endl;
cout<<"2.按课程查找"<<endl;
cout<<"0.退出"<<endl;
cout<<endl;
int choice;
cin>>choice;
return choice;
}
void SearchMenuCortrol()
{
while(1)
{
int chioce=SearchMenu();
if(choice==0) break;
switch(choice)
{
case 1:SearchByName(); break;
case 2:SearchByCourse(); break;
}
}
}
void SearchByName()
{
innt n=0;
cout<<"请输入姓名:";
string name;
cin>>name;
for(p=head->next,p!=NULL;p=p->next)
if(p->data.GetName()==name)
{
p->data.ShowInfo();
n++;
}
if(n==0) cout<<"没有相关记录!"<<endl;
cout<<endl;
}
void SearchByCourse()
{
int n=0;
cout<<"请输入查找课程:";
string c;
cin>>c;
for(p=head->next,p!=NULL;p=p->next)
{
vector<string> course=p->data.GetCourse();
for(int i=0;i<3;i++)
if(c==course[i])
{
p->data.ShowInfo();
n++;
break;
}
}
if(n==0) cout<<"没有相关记录!"<<endl;
cout<<endl;
} 
void NewList()
{
Destory();
head=tail=new CNode;
head->next=NULL;
while(1)
{
p=new CNode;
cout<<"请输入:"<<endl;
cout<<":";
string name;
cin>>name;
cout<<"年龄:";
int age;
cin>>age;
cout<<"性别(F/M):";
char sex;
cin<<sex;
p->data.SetNameAndSex(name,sex);
p->data.SetAge(age);
cout<<"职称:";
string title;
cin>>title;
cout<<"职工号:";
string teano;
cin>>teano;
p->data.SetData(title,teano);
cout<<"教授课程:";
string couurse[3];
cin>>course[0]>>course[1]<<course[2];
p->data.SetCourse(course[0],course[1],course[2])
cout<<"教学效果评分:";
float score;
cin>>score;
p->data.SetScore(score);
tail->naxt=p;
tail=p;
num++;
cout<<"是否继续输入?(Y/N):";
char c;
cin>>c;
cin get();
if(c!='y') break;
}
tail->next=NULL;
}
void Save()
{
char fname[80];
cout<<"";
cin<<fname;
ofstream file(fname);
if(!file)
{
cout<<"出现未知粗偶无导致无法打开!"<<endl;
exit(1);
}
for(p=head->next,p!=NULL;p=p->next)
{
vector<string> course=p->data.GetCourse();
file<<p->data.GetTeano()<<"\t"
    <<p->data.GetName()<<"\t"
    <<p->data.GetAge()<<"\t"
   <<p->data.GetSex()<<"\t"
    <<p->data.GetTitle()<<"\t"
   <<course[0]<<"\t"<<course[1]<<"\t"<<course[2]<<"\t"
   <<p->data.GetScore()<<endl;
}
file.close();
}
void Destory()
{
for(p=head->next,p!=NULL;p=p->next)
{
head->next=p->next;
delete p;
}
delete head;
head=NULL;
tail=NULL;
pre=NULL;
num=0;
}
~CList()
{
for(p=head->next,p!=NULL;p=head->next)
{
head->next=p->next;
delete p;
}
delete head;
head=NULL;
tail=NULL;
pre=NULL;
}
};
int main(int argc,char*argv[])
{
CList list1;
list1.MainMenuControl();
CList list2;
list2.MaiMenuControl();
return 0;
}

 

有main方法呢,直接运行main方法就可以了,是运行不了呢?还是别的问题?

您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~

如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632