Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- class tochka {
- protected:
- int a1, a2, a3;
- public:
- tochka() {}
- tochka(int x, int y, int z) {
- a1 = x;
- a2 = y;
- a3 = z;
- }
- void show() {
- setlocale(LC_ALL, "Russian");
- cout << "Координаты: " << endl;
- cout << "x= " << a1 << endl << "y= " << a2 << "z= " << a3 << endl;
- }
- };
- class Krug :public tochka {
- public:
- double S, R, V;
- int b1, b2, b3;
- int c1, c2, c3;
- Krug() :tochka() {}
- Krug(int x, int y, int z, int t, int q, int w) :tochka(x, y, z) {
- b1 = q;
- b2 = t;
- b3 = w;
- // c1 = m;
- // c2 = n;
- // c3 = k;
- }
- double rr() {
- R = sqrt((pow(a2 - a1, 2)) + (pow(b2 - b1, 2)));
- return R;
- }
- double AA() {
- S = 0;
- return S;
- }
- double oo() {
- V = sqrt(4 * 3.14 / R; // o = (4/3*3.14*pow(r, 3)); // V = (4 / 3 * 3.14*pow(R, 3))
- return V;
- }
- void objm() {
- setlocale(LC_ALL, "Russian");
- cout << "Площадь = " << R << endl;
- cout << "Радиус круга = " << V << endl;
- cout << "Объём круга =" << S << endl;
- }
- };
- int main() {
- tochka pp;
- Krug pi(1, 2, 3, 4, 5, 6);
- pi.show();
- pi.rr();
- pi.AA();
- pi.oo();
- pi.objm();
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement