include iostream include cstring include iomanip using namespace std c

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <iostream>
#include <cstring>
#include <iomanip>
using namespace std;
class prepod
{
int god, para;
char name[30];
public:
prepod();
prepod(int god1);
prepod(int god1, char name1[]);
~prepod();
void vvod();
void vivod();
};
prepod::prepod()
{
cout<<"Vvedite god"<<endl;
cin>>god;
cout<<"Vvedite name"<<endl;
cin>>name;
cout<<"bez parametrov"<<endl<<endl;
}
prepod::prepod(int god1)
{
cout<<"Vvedite name"<<endl;
cin>>name;
cout<<"Vvedite kolichestvo par"<<endl;
cin>>para;
god=god1;
cout << "god rozhdenija" << endl << god1 << endl;
cout << name << setw(4) << para << setw(6) << god1 << endl << endl;
}
prepod::prepod(int para1, char name1[])
{
cout<<"Vvedite god rozhdenija"<<endl;
cin>>god;
para=para1;
strcpy(name, name1);
cout << "name " << name1 << endl;
cout << god << setw(4) << para1 << setw(8) << name1 << endl << endl;
}
void prepod::vvod()
{
cout<<"vvod cherez ukazatel"<<endl;
cout<<"Vvedite god rozhdenija"<<endl;
cin>>god;
cout<<"Vvedite name"<< endl;
cin>>name;
cout<<"Vvedite kolichestvo par"<<endl;
cin>>para;
}
void prepod::vivod()
{
cout << god << setw(8) << name << setw(4) << para << endl;
}
prepod::~prepod()
{
cout<<"destruktor rabotaet"<<name<<endl;
}
int main()
{
prepod a, b(1996), c(4,"Evgeny");
prepod *x, y;
x=&y;
x->vvod();
x->vivod();
return 0;
}