Merge pull request #168 from alarak233/patch-1

Update 2.友元运算符实现.cpp
This commit is contained in:
Francis 2022-04-10 16:33:11 +08:00 committed by GitHub
commit c7ed2fcbcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,16 +1,16 @@
/*
C++std中预定义了复数类Complex
Complex的各种运算+-*/
使using namespace std将std名字空间引入本程序
Complex将与std名字空间中的Complex类的运算符重载函数产生冲突
C++std中预定义了复数类Complex
Complex的各种运算+-*/
使using namespace std将std名字空间引入本程序
Complex将与std名字空间中的Complex类的运算符重载函数产生冲突
*/
/*
+-*/
+-*/
*/
//解决前面的2+b问题。
//解决前面的2+b问题。
#include<iostream>
@ -44,6 +44,7 @@ Complex operator*(Complex a, Complex b){
Complex t;
t.r = a.r*b.r-a.i*b.i;
t.i = a.r*b.i+a.i*b.r;
return t;
}
Complex operator/(Complex a, Complex b){
Complex t;