第一节类和对象的基本概念 #include <iostream.h> #include <math.h> struct complex i double real double imag; void init(double r, double i f real=r;imag=i;) double realcomplex() return real,) double imagcomplex() ireturn imag; double abscomplexo) i double t; t=sqrt(real*real+imag*imag) return t)第一节 类和对象的基本概念 #include <iostream.h> #include <math.h> struct complex { double real; double imag; void init(double r,double i) { real=r;imag=i;} double realcomplex( ) {return real;} double imagcomplex( ) {return imag;} double abscomplex( ) { double t; t=sqrt(real*real+imag*imag); return t;} };