Help solve, please.
Create a class of angles on a plane with data members angle value in degrees and minutes. Overload the input and output operators of the object, addition and subtraction of angles. Create member functions for converting an angle from degrees to radians and vice versa, calculating trigonometric functions. Create an example to demonstrate the capabilities of the class.
UPD: That's what I have: http://pastie.org/9328088
#include <iostream> #include <cmath> using namespace std; class Angle { static const double Pi; public: Angle(double deg = 0.0, double amin = 0.0): _angle(deg + amin / 60.0) {} double getAngle() const { return _angle; } double transInRad() const { return _angle * Pi / 180; } double transInDeg() const { return transInRad() * 180 / Pi; } double sin() const { return std::sin(transInRad()); } double cos() const { return std::cos(transInRad()); } double tan() const { return std::tan(transInRad()); } private: double _angle; }; const double Angle::Pi = 3.14159265358979323; int main() { Angle a1(25.0, 18.0); std::cout << "Угол:\n" << a1.getAngle() << "\n"; std::cout << "Переводим его в радианы:\n" << a1.transInRad() << "\n"; std::cout << "Затем обратно в градусы:\n" << a1.transInDeg() << "\n"; std::cout << "Вычисляем sin угла:\n" << a1.sin() << "\ncos:\n" << a1.cos() << "\ntg:\n" << a1.tan() << "\nctg:\n" << 1/a1.tan(); return 0; }
I also need to "Overload the input and output operators of the object, addition and subtraction of angles."