A
andru1312
C++:
#include <iostream>
#include <string>
using namespace std;
class school
{
protected:
int nomer;
float staj;
public:
school():nomer(0),staj(0)
{}
school(int d,float c):nomer(d),staj(c)
{}
void getschool()
{
cout<<"Введiть номер школи: ";
cin>>nomer;
cout<<"Введiть стаж: ";
cin>>staj;
getchar();
}
void show()const
{
cout<<"номер школи: "<<nomer<<endl;
cout<<"стаж:"<<staj<<" "<<"рокiв"<<endl;
}
};
class direktor:public school
{
private:
string iniciali;
public:
void getdirektor()
{ cout<<"Введiть iнiцiали: ";
getline(cin,iniciali);
school::getschool();
}
void showdirektor()const
{
cout<<"\niнiцiали: "<<iniciali<<endl<<endl;
school::show();
}
};
class teacher:public school
{
private:
string inicialib;
public:
void getteacher()
{ cout<<"Введiть iнiцiали: ";
getline(cin,inicialib);
getchar();
school::getschool();
}
void showteacher()const
{
cout<<"\niнiцiали: "<<inicialib<<endl;
school::show();
}
};
int main()
{
setlocale(0,"rus");
direktor a;
teacher b;
cout<<"Введiть даннi про директора"<<endl;
a.getdirektor();
a.showdirektor();
cout<<"\nВведiте даннi про вчителя"<<endl;
b.getteacher();
b.showteacher();
cout<<endl;
system ("pause"); return 0;}