feat: 统一 cpp 文件编码格式为 utf-8

This commit is contained in:
tracyxiong1
2023-01-02 20:39:00 +08:00
parent ade7173887
commit 368eda305f
63 changed files with 327 additions and 327 deletions

View File

@@ -1,4 +1,4 @@
//有复数类Complex利用运算符重载实现复数的加、减、乘、除等复数运算。
//有复数类Complex利用运算符重载实现复数的加、减、乘、除等复数运算。
#include<iostream>
using namespace std;
class Complex {
@@ -21,7 +21,7 @@ Complex Complex::operator -(Complex b)
{
return Complex(r-b.r,i-b.i);
}
//求复数相乘的算法
//求复数相乘的算法
Complex Complex::operator *(Complex b)
{
Complex t;
@@ -29,7 +29,7 @@ Complex Complex::operator *(Complex b)
t.i=r*b.i+i*b.r;
return t;
}
//求复数相除的算法
//求复数相除的算法
Complex Complex::operator /(Complex b) {
Complex t;
double x;
@@ -48,8 +48,8 @@ void Complex::display(){
int main(void) {
Complex c1(1,2),c2(3,4),c3,c4,c5,c6;
Complex a,b(2,3);
a=b+2; //正确
// a=2+b; //错误
a=b+2; //正确
// a=2+b; //错误
a.display();
c3=c1+c2;
c4=c1-c2;