标签:函数 turn image c++ public nbsp code complex 复制构造
#include<iostream> using namespace std; class point{ public: rect(float L,float W){ length=L; wide=W; } area_print(){ cout<<length*wide; } private: float length,wide; }; int main(){ float length,wide; cin>>length>>wide; rect a(length,wide); a.area_print(); return 0; }
3.
#include<iostream> using namespace std; class Complex { public: Complex(float at,float bt) { a=at; b=bt; } Complex(float at) { a=at; } void add(Complex &p) { a=a+p.a; b=b+p.b; } void show() { cout<<a<<"+"<<b<<"i"; } private: double a,b; }; int main(){ Complex c1(3,5); Complex c2=4.5; c1.add(c2); c1.show(); return 0; }
标签:函数 turn image c++ public nbsp code complex 复制构造
原文地址:https://www.cnblogs.com/escanor-lunbu-hh/p/8748116.html