#include <iostream.h>
#define N 3
class Employee{
public:
char no[10];
char name[10];
char depart[10];
int age;
double salary;
Employee(){}
void Creat();
void Display();
void Display(char n[]);
};
void Employee::Creat()
{
cout<<"input no:"<<endl;
cin>>no;
cout<<"input name:"<<endl;
cin>>name;
cout<<"input depart:"<<endl;
cin>>depart;
cout<<"input age:"<<endl;
cin>>age;
cout<<"input salary:"<<endl;
cin>>salary;
}
void Employee::Display()
{
cout<<name<<no<<depart<<age<<salary<<endl;
}
void Employee::Display(char no[])
{
cout<<no<<name<<depart<<age<<salary<<endl;
}
void main()
{
int i;
Employee employee[N];
for(i=0;i<N;i++)
{
employee[i].Creat();
cout<<"display all"<<endl;
}
for(i=0;i<N;i++)
{
employee[i].Display();
cout<<"display according to no."<<i<<endl;
}
for(i=0;i<N;i++)
{
employee[i].Display(employee[i].no);
cout<<"display according to depart."<<endl;
}
for(i=0;i<N;i++)
{
employee[i].Display(employee[i].depart);
}
}
呵呵
怕你找不到 给你打出来了 你的COUT 再规范规范 输出都在一块