double imag; };
double Complex::get_real() {return real;}
double Complex::get_imag() {return imag;}
void Complex::display()
{cout<<\
Complex operator + (Complex &c1,Complex &c2) {
return Complex()+(),()+()); }
int main()
{Complex c1(3,4),c2(5,-10),c3; c3=c1+c2; cout<<\ (); return 0; } 2:
#include
Complex(){real=0;imag=0;}
Complex(double r,double i){real=r;imag=i;} Complex operator+(Complex &c2); Complex operator-(Complex &c2); Complex operator*(Complex &c2); Complex operator/(Complex &c2); void display(); private: double real; double imag; };
Complex Complex::operator+(Complex &c2) {Complex c; =real+; =imag+; return c;}
Complex Complex::operator-(Complex &c2) {Complex c; =; =; return c;}
Complex Complex::operator*(Complex &c2) {Complex c; =real**; =imag*+real*;
return c;}
Complex Complex::operator/(Complex &c2) {Complex c; =(real*+imag*/*+*; =(imag**/*+*; return c;}
void Complex::display()
{cout<<\
int main()
{Complex c1(3,4),c2(5,-10),c3; c3=c1+c2; cout<<\ (); c3=c1-c2; cout<<\ (); c3=c1*c2; cout<<\ (); c3=c1/c2; cout<<\ (); return 0; } 3:
#include
#include
class Teacher um<<\\\ ((char *)&staf[i],sizeof(staf[i]));}
cout<<\ for(i=0;i<2;i++) {cin>>>>>>>>; (0,ios::end);
((char *)&staf1,sizeof(staf1));} (0,ios::beg); for(i=0;i<7;i++)
{((char *)&staf[i],sizeof(staf[i])); cout< cout<<\ cin>>num; while(num) {find=false; \ \ (0,ios::beg); for(i=0;i<7;i++) {((char *)&staf[i],sizeof(staf[i])); if(num==staf[i].num) {m=(); cout< \ find=true; break; } } if(!find) cout<<\ cout<<\ cin>>num; } (); return 0; } 6:解法一 #include struct student \