// A Vector class implementation
#include <iostream>
#include <cmath>
using namespace std;

// The Vector class declaration
class Vector{
  private:
    double m_x, m_y;
  public:
    Vector(double =0.0, double =0.0);
    double magnitude();
    double theta();
    void   scale(double);
    void   unitvector(double &, double &);
};

int main(){
  Vector v(3.0, 4.0);
  double ux, uy;

  cout << v.magnitude() << endl;
  v.scale(2);
  cout << v.magnitude() << endl;
  cout << v.theta() << endl;
  v.unitvector(ux, uy);
  cout << ux << '\t' << uy << endl;
}

// Constructor function
Vector::Vector(double x, double y){
  m_x=x; m_y=y;
}
// Magnitude (norm) of the vector
double Vector::magnitude(){
  return sqrt(m_x*m_x + m_y*m_y);
}
// Angle in degrees between the vector direction and x-axis
double Vector::theta(){
  return atan(m_y/m_x) * 180.0/M_PI;
}
// Scale the vector by a constant c
void Vector::scale(double c){
  m_x *= c;
  m_y *= c;
}
// Components the of the unit vector in the direction of the vector
void Vector::unitvector(double &ux, double &uy){
  ux = m_x/magnitude();
  uy = m_y/magnitude();
}
