
- •Практичне заняття 8 Теоретична частина
- •Завдання
- •Int main()
- •Void push(int var)
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Лабораторне заняття 9 Теоретична частина
- •Зміст завдання
- •Лабораторне заняття 10 Теоретична частина
- •Практичне заняття 9 Теоретична частина
- •Завдання
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Практичне заняття 10-11 Теоретична частина
- •Завдання
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Лабораторне заняття 11-12 Теоретична частина
- •Завдання 1
- •Завдання 2
- •Завдання 3
- •Int main()
- •Практичне заняття 12-13 Теоретична частина
- •Завдання
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Лабораторне заняття 13 Теоретична частина
- •Завдання 1
- •Int main()
- •Завдання 2
- •Практичне заняття 14 Теоретична частина
- •Завдання
- •Int main()
- •Int main()
- •Лабораторне заняття 14 Теоретична частина
- •Завдання
Int main()
{clrscr();
manager m1;
scientist s1,s2;
laborer l1;
cout<<endl;
cout<<”\nМенеджер 1:”;
m1.getdata();
cout<<”\nВчений 1:”;
s1.getdata();
cout<<”\nВчений 2:”;
s2.getdata();
cout<<”\nРобітник 1:”;
l1.getdata();
cout<<”Менеджер1\n”;
m1.putdata();
cout<<”Вчений1\n”;
s1.putdata();
cout<<”Вчений2\n”;
s2.putdata();
cout<<”Робітник1\n”;
l1.putdata();
bioskey(0);
return 0;
}
Програма 17.9
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<bios.h>
#include<string.h>
class Type
{private:
char *dimensions;
char *grade;
public:
Type():dimensions(“N/A”),grade(“N/A”)
{ }
Type(char *d1,char *d2):dimensions(d1),grade(d2)
{ }
void gettype()
{cout<<”Розмір:”;cin>>dimensions;
cout<<”Сорт:”;cin>>grade;
}
void showtype()
{
cout<<”Розмір:”<<dimensions<<endl;
cout<<”Сорт:”<<grade<<endl;
}
};
///////////////
class Distance
{private:
int feet;
float inches;
public:
Distance():feet(0),inches(0.0)
{}
Distance(int ft,float in):feet(ft),inches(in)
{}
void getdist()
{cout<<”Фути:”;cin>>feet;
cout<<” дюйми:”;cin>>inches;
}
void showdist() const
{
cout<<feet<<”\-“<<inches<<’\”’;
}
};
////////////////
class Lumber:public Type,public Distance
{private:
int quantity;
double price;
public:
Lumber():Type(),Distance(),quantity(0),price(0.0)
{}
Lumber (char *dt, char *gr,
int ft, float in,
int qu,float prc):Type(dt,gr),Distance(ft,in),quantity(qu),price(prc)
{ }
void getlumber()
{Type::gettype();
Distance::getdist();
cout<<”Введіть кількість:”;cin>>quantity;
cout<<”Введіть ціну:”;cin>>price;
}
void showlumber()const
{
Type::showtype();
cout<<”\n Dovjyna:”;
Distance::showdist();
cout<<”\n Вартість ”<<quantity<<” штук:”<<(price*quantity);
}
};
///////////////
Int main()
{clrscr();
Lumber studs;
cout<<”\n Інформація\n”;
studs.getlumber();
Lumber studs1(“2x4”,”const”,8,1.0,200,14);
cout<<”\n1=”;studs.showlumber();
cout<<”\n2=”;studs1.showlumber();
bioskey(0);
return 0;
}
Програма 17.10
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<bios.h>
const int LEN=80;
class student
{private:
char school[LEN];
char degree[LEN];
public:
void getedu()
{cout<<”School:”;
cin>>school;
cout<<”Degree:”;
cin>>degree;
}
void putedu() const
{cout<<”\nSchool=”<<school;
cout<<”\nDegree=”<<degree<<endl;
}
};
//////////////
class employce
{private:
char name[LEN];
unsigned long number;
public:
void getdata()
{cout <<”\nВведіть ПІП: “;cin>>name;
cout <<”\nВведіть номер: “;cin>>number;
}
void putdata() const
{cout<<”\nПІП=”<<name;
cout<<”\nНомер=”<<number;
}
};
//////////////
class manager
{private:
char title[LEN];
double dues;
employce emp;
student stu;
public:
void getdata()
{emp.getdata();
cout<<”\nPosada=”;cin>>title;
cout<<”\nVnesky=”;cin>>dues;
stu.getedu();
}
void putdata() const
{emp.putdata();
cout<<”\nPosada=”<<title;
cout<<”\nVnesky=”<<dues;
stu.putedu();
}
};
///////////
class scientist
{private:
int puts;
employce emp;
student stu;
public:
void getdata()
{ emp.getdata();
cout<<”\nPublications=”;cin>>puts;
stu.getedu();
}
void putdata() const
{ emp.putdata();
cout<<”\nPublications=”<<puts;
stu.putedu();
}
};
////////////
class laborer
{private:
employce emp;
public:
void getdata()
{emp.getdata();}
void putdata() const
{emp.putdata();}
};
////////////