当前位置: 首页 > news >正文

洛阳住房与城乡建设厅网站自媒体是如何赚钱的

洛阳住房与城乡建设厅网站,自媒体是如何赚钱的,桂林疫情,无锡前洲行业网站建设关于C操作符重载&#xff0c;可以用类内的成员运算符重载或友元函数。但是注意两个不能同时出现&#xff0c;不然编译出错。 #include<iostream> using namespace std; class Complex{public:Complex(int r0,int i0){real r;imag i;}//#if 0Complex operator(Complex …

关于C++操作符重载,可以用类内的成员运算符重载或友元函数。但是注意两个不能同时出现,不然编译出错。

#include<iostream>
using namespace std;
class Complex{public:Complex(int r=0,int i=0){real = r;imag = i;}//#if 0Complex operator+(Complex &c) {cout << " internal function is called" << endl;Complex c2;c2.real = this->real + c.real;c2.imag = this->imag + c.imag;return c2;}
//    #endif void print();friend Complex operator+(int a,Complex &c2); //声明友元运算符重载函数,+的左侧是整数,右侧是类的对象 friend Complex operator+(Complex c1,int a);//声明友元运算符重载函数,+的右侧是整数,左侧是类的对象
//     friend Complex operator+(Complex c1,Complex c2);//声明友元运算符重载函数,+的右侧是整数,左侧是类的对象 private:int real;int imag;
};
Complex operator+(int a,Complex &c2)  //定义友元运算符重载函数,+的左侧是整数,右侧是类的对象 
{Complex temp;cout << "friend function 1 is called" << endl;temp.real = a+c2.real;temp.imag = c2.imag;return temp;
}
Complex operator+(Complex c1,int a)//定义友元运算符重载函数,+的右侧是整数,左侧是类的对象 
{Complex temp;cout << "friend function 2 is called" << endl;temp.real = c1.real+a;temp.imag = c1.imag;return temp;
} 
#if 0
Complex operator+(Complex c1,Complex c2)
{Complex temp;cout << "friend function 3 is called" << endl;temp.real = c1.real+c2.real;temp.imag = c1.imag+c2.imag;return temp;
}
#endifvoid Complex::print()
{cout<<real<<"+"<<imag<<'i'<<endl;
}int main()
{Complex co1(30,40),co2(30,40),co3,co4;co1.print();co3=100+co1;  //co3=operator+(100,co1); co3.print();co3=co2+100;  //co3=operator+(co2,100);co3.print();co4=co2+co3;co4.print();return 0;
}
http://www.hkea.cn/news/356491/

相关文章:

  • 潍坊快速网站排名网站是怎么做出来的
  • 聚美优品的pc网站建设注册网址
  • 陕西省住房与城乡建设厅网站免费b站推广软件
  • 淮南市住房与城乡建设部网站网店买卖有哪些平台
  • 网页qq表情佛山百度快速排名优化
  • 网站建设方案论文1500社会新闻最新消息
  • 网站组建 需求分析市场监督管理局职责
  • 云课堂哪个网站做的好厦门关键词优化seo
  • 中企动力沈阳分公司seo免费诊断电话
  • 网站vps被黑湖人最新排名最新排名
  • 如何夸奖客户网站做的好seo课程心得体会
  • 有哪些做电子商务的网站时空seo助手
  • 临沂百度网站电脑培训机构哪个好
  • 无锡专业做网站的公司怎样把自己的产品放到网上销售
  • 大学网站建设管理办法推广技巧
  • 长春做网站公司seo关键词排名优化软件怎么选
  • 网站开发未按合同约定工期完工seo关键词排名怎么提升
  • 创可贴app海报制作网站百度seo优化方法
  • 龙岗品牌网站建设2024年新闻摘抄
  • 南阳住房和城乡建设厅网站招聘网站排名
  • 如何做网站活动封面建站的公司
  • 温州网站建设培训营销推广方案包括哪些内容
  • 厦门 建网站商业软文案例
  • wordpress读者墙站长之家seo工具包
  • 网站建设哪家好灵活苏州久远网络北京搜索引擎关键词优化
  • 网站优化怎么做 有什么技巧东莞seo建站
  • 什么网站可以做游戏机疫情最新数据消息
  • 企业网站开发报价单巩义网络推广
  • 网站开发技术交流群免费域名申请网站
  • 手机网站一键分享怎么知道自己的域名