实验5 类和对象实验报告(9)
发布时间:2021-06-06
发布时间:2021-06-06
除:("<<x1<<","<<y1<<")/("<<x2<<","<<y2<<")="<<"("<<static_cast<double>(x1*x2+y1*y2)/(x2*x2+y2*y2)<<","<<static_cast<double>(y1*x2-x1*y2)/(x2*x2+y2*y2)<<")"<<endl<<endl;}
void set()
{ cout<<"第一个复数:" ;
cin>>x1>>y1;
cout<<"第二个复数:";
cin>>x2>>y2;
}
};
int main()
{
Complex a;
Complex c(4,3,2,1);
cout<<"以(a, b)的形式打印复数,其中a为实部,b为虚部,其中系统默认的复数为(1,1)"<<endl<<endl;
cout<<"1.未初始化值"<<endl;
a.jia();
a.jian();
a.chen();
a.chu();
cout<<"2.初始化值"<<endl;
c.jia();
c.jian();
c.chen();
c.chu();
cout<<"3.自定义"<<endl;
a.set();
a.jia();
a.jian();
a.chen();
a.chu();
return 0;
}
上一篇:《旅游策划学》旅游路线设计例子
下一篇:英语四级段落翻译训练资料