#ifndef INCLUDE_VEC2 #define INCLUDE_VEC2 #include #include using namespace std; class Vec2{ private: double ele[2] ; public: Vec2( double x , double y ) { ele[ 0 ] = x ; ele[ 1 ] = y ;} Vec2( ) { ele[ 0 ] = 0 ; ele[ 1 ] = 0 ; } Vec2 & operator=( const Vec2 & c ) ; Vec2 & operator+=( const Vec2 & c ) ; Vec2 & operator-=( const Vec2 & c ) ; double get( int i ) const { return ele[ i ] ; } void set( int i , double x ) { ele[ i ] = x ; } Vec2 operator + ( ) const { return *this ; } Vec2 operator + ( Vec2 c ) const ; Vec2 operator - ( ) const ; Vec2 operator - ( Vec2 c ) const ; double abs() const ; double norm() const ; friend double prod( const Vec2 & , const Vec2 & ) ; }; std::ostream &operator<<(std::ostream & , const Vec2 & ); #endif