h8.cpp~

来自「刮大风歌但范甘迪给对方 但范甘迪分给对方国的国的风格」· CPP~ 代码 · 共 112 行

CPP~
112 行
字号
#include"h8.h"Vector::Vector(double x_ ,double y_){	x = x_;	y = y_;	direction = 0;	length = 0;}Vector::Vector(const Vector& temp){	x = temp.x;	y = temp.y;	length=temp.length;	direction = temp.direction;}Vector::~Vector(){}void Vector::set_length(){	length = sqrt(x*x+y*y);}void Vector::set_dirextion(){	direction = atan(y/x);}Vector Vector::operator+(const Vector& temp)const{	return Vector(x+temp.x,y+temp.y);}Vector Vector::operator-(const Vector& temp)const{	return Vector(x-temp.x,y-temp.y);}Vector Vector::operator*(const Vector& temp)const{	return Vector(x*temp.x,y*temp.y);}Vector& Vector::operator=(const Vector& temp){	x=temp.x;	y=temp.y;}Vector& Vector::operator--(){	x--;	y--;	return *this;}Vector& Vector::operator++(){	x++;	y++;	return *this;	}Vector Vector::operator++(int){	Vector temp(x,y);	x++;	y++;	return temp;}Vector Vector::operator--(int){	Vector temp(x,y);	x--;	y--;	return temp;}double operator*(double i,Vector& temp){	return i*temp.x;}ostream& operator<<(ostream& out,Vector& temp){	out<<"Vector:"<<"("<<temp.x<<','<<temp.y<<")"<<endl;	temp.set_length();	temp.set_dirextion();	out<<"Length:"<<temp.length<<".\n"<<"Direction:"<<temp.direction<<".\n";}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?