标签:
#include <iostream>
using namespace std;
class Complex {
public: Complex(int a,int b)
{re=a;im=b;};
Complex (float a){
storea=a;};
void add(Complex p) {
re+=p.storea;}
void show(){
cout<<re<<" + "<<im<<"i"<<endl;
}
private:float re,im;
float storea;
};
/////////////////////////////////////////////
int main () {
Complex c1(3,5);
Complex c2=4.5;
c1.add(c2);
c1.show();
}
标签:
原文地址:http://www.cnblogs.com/wanna/p/4324720.html