Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "math.h"
- #include <iostream>
- using namespace std;
- class number {
- public: double value;
- number (double val):value(val){}
- double getabs() { return abs(value); }
- double getInt() { return (int)value; }
- };
- class irrational : public number {
- public:
- using number::number;
- };
- int main()
- {
- setlocale(0, "");
- double a, b, c;
- cout << "Введите число: \n";
- cin >> a;
- cin >> b;
- cin >> c;
- number n1(a);
- number n2(b);
- number n3(c);
- cout << "Модуль числа: \n";
- cout << n1.getabs() << endl;
- cout << n2.getabs() << endl;
- cout << n3.getabs() << endl;
- cout << "Целая часть: \n";
- cout << n1.getInt() << endl;
- cout << n2.getInt() << endl;
- cout << n3.getInt() << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement