📄 ttt.h
字号:
people p;student t;teacher a;graduate g;TA T;
int peopleNO=0,studentNO=0,teacherNO=0,graduateNO=0,TANO=0;int number;
void Swap(people&p1,people&p2)//辅助函数交换people类的对象
{
people t;
t=p1;
p1=p2;
p2=t;
}
void SelectionSort(people p[] ,int n)//对people类的对象进行排序
{
int smallIndex;
int i,j;
for(i=0;i<n-1;i++)
{
smallIndex=i;
for(j=i+1;j<n;j++)
if(p[j].number<p[smallIndex].number)
smallIndex=j;
Swap(p[i],p[smallIndex]);
}
cout<<"按编号由小到大排列为:"<<endl;
for(i=0;i<n;i++)
{
p[i].Getpeople();
}
}
void SeqSeach(people p[],int n)
{
int number;char ch;
cout<<"请输入你要查找对象的编号:"<<endl;
cin>>number;
for(int i=0;i<n;i++)
{
if(number==p[i].number)p[i].Getpeople();
}
if(number!=p[i].number) cout<<"there is not the people"<<endl;
cout<<"继续输入吗?是'Y'否'N':"<<endl;
cin>>ch;
if(ch=='Y')
SeqSeach( p, n);
}
void Set(int i)
{
switch(i)
{
case 0:{cout<<"请输入people的信息:"<<endl;p.Setpeople();peopleNO++;}break;
case 1:{cout<<"请输入student的信息:"<<endl;t.Setstudent1();t.Setstudent2();studentNO++;}break;
case 2:{cout<<"请输入teacher的信息:"<<endl;a.Setteacher1();a.Setteacher2();teacherNO++;}break;
case 3:{cout<<"请输入graduate的信息:"<<endl;g.Setgraduate1();g.Setgraduate2();graduateNO++;}break;
case 4:{cout<<"请输入TA的信息:"<<endl;T.SetTA();TANO++;}break;
default:cout<<"Error!you must enter 0,1,2,3or4"<<endl;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -