⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 h8.cpp

📁 刮大风歌但范甘迪给对方 但范甘迪分给对方国的国的风格
💻 CPP
字号:
#include"h8.h"//public方法实现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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -