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

数据可视化网站模板帮企业外卖网站做推

数据可视化网站模板,帮企业外卖网站做推,网页设计实验报告模板,h5手机网站建设是什么意思作业#xff1a; 1 思维导图 2 整理代码 1. 拷贝赋值函数课上代码 //拷贝赋值函数课上代码 #includeiostream using namespace std;//创建类 class Stu { private://私有的string name;int socer;int *age;//此处注意用到指针类型 public://共有的//无参构… 作业 1 思维导图 2 整理代码 1. 拷贝赋值函数课上代码 //拷贝赋值函数课上代码 #includeiostream using namespace std;//创建类 class Stu { private://私有的string name;int socer;int *age;//此处注意用到指针类型 public://共有的//无参构造函数系统默认设置Stu(){cout Stu:: 无参构造函数 endl;}//有参构造函数自定义自定义后需要将无参构造函数显性Stu(string n,int s,int a):name(n),socer(s),age(new int (a))//初始化列表{cout Stu:: 有参构造函数 endl;}//拷贝构造函数Stu(const Stu other):name(other.name),socer(other.socer),age(new int(*other.age))//此处注意*other.age因为定义是指针类型所以要去指针指向的内容进行赋值{cout Stu:: 拷贝构造函数 endl;}//拷贝赋值函数Stu operator(const Stu other) //此处不能用初始化列表因为是赋值操作{if(this ! other)//给自己赋值多此一举{nameother.name;socerother.socer;age new int (*other.age);//深拷贝赋值因为有指针防止段错误。。。}cout Stu:: 拷贝赋值函数 endl;//注意返回值是自身引用return *this;}//析构函数~Stu()//会自动调用{cout Stu:: 析构函数 endl;}}; int main() {Stu s1;//无参构造函数Stu s2(王一博,100,23);//有参构造函数Stu s3(s2); //拷贝构造函数》将s2拷贝给s3》Stu s3s2s1s3;//拷贝赋值return 0; }2.匿名对象用来初始化有名对象课上代码 void fun(Stu g)//形参接收实参的值》Stu gStu(lisa,120,25) {} int main() {Stu s1;//无参构造函数Stu s2(王一博,100,23);//有参构造函数Stu s3(s2); //拷贝构造函数》将s2拷贝给s3》Stu s3s2//用到匿名对象给有名对象初始化Stu s4Stu(赵云,88,40);//给数组初始化Stu s[2]{Stu(哪吒,200,40),Stu(张飞,300,30)};//和c中初始化相似//匿名对象作为函数实参使用fun(Stu(lisa,120,25));s1s3;//拷贝赋值return 0; }3.全局函数作友元,课上代码 //友元上课代码全局函数作友元 #include iostream using namespace std; //封装 房间类 class Room {friend void goodfriend(Room r);//关键字friend private://私有的string bedroom;//卧室 public://共有的string sittingroom;//客厅 public:Room(){//在类内赋值bedroom卧室;sittingroom客厅;} }; //全局函数作友元 void goodfriend(Room r) {cout 好朋友正在参观 r.sittingroom endl;//共有权限访问成功毋庸置疑cout 好朋友正在参观 r.bedroom endl;//报错原因私有权限类外不可访问需要用友元 }int main() {Room r;goodfriend(r);return 0; }4.成员函数作友元课上代码 //成员函数作友元 #include iostream using namespace std; class Room;//需要声明一下以免下面用到系统不知道报错 //封装好朋友类 class goodfriend { private:Room *r;//用到指针是因为指针的大小是固定的而变量的大小不明系统无法分配空间 public:goodfriend();//在类内声明void vist();//在类内声明 };//封装 房间类 class Room {/*friend void goodfriend(Room r);//关键字friend*/friend void goodfriend::vist(); private://私有的string bedroom;//卧室 public://共有的string sittingroom;//客厅 public:Room(){//在类内赋值bedroom卧室;sittingroom客厅;} }; //类外实现 goodfriend::goodfriend() {rnew Room;//申请空间 } void goodfriend::vist() {cout 好朋友正在参观 r-sittingroom endl;//共有权限访问成功毋庸置疑cout 好朋友正在参观 r-bedroom endl;//报错原因私有权限类外不可访问需要用友元//指针需要用- }全局函数作友元 //void goodfriend(Room r) //{ // cout 好朋友正在参观 r.sittingroom endl;//共有权限访问成功毋庸置疑 // cout 好朋友正在参观 r.bedroom endl;//报错原因私有权限类外不可访问需要用友元 //}int main() {Room r;//goodfriend(r);goodfriend g;g.vist();return 0; } 5.课前热身 int const a; //...... int const *p; //...... int * const p; // int const * const p; // const int fun() {} //该函数是返回一个常整型变量 6.常成员函数非常成员函数 1.非常对象可以调用常成员函数也可以调用非常成员函数优先调用非常成员函数 2.常对象只能调用常成员函数如果没有常成员函数则报错 #include iostream using namespace std; class Stu { private:string name;//只对该成员变量在常成员函数中可以被修改mutableint id; public:Stu(){}Stu(string name,int id):name(name),id(id){}//常成员函数void display()const //》Stu const * const this;表示指针的值和指向都不可改{//this -name li si;报错原因因为被const修饰不可以更改cout name id endl;}//非常成员函数void display()//Stu * const this;和常成员重载{this - name lisi;cout name id endl;}};int main() {cout Hello World! endl;const Stu s1(zhangsan,1001);//常对象s1.display();//常对象只能调用常成员函数return 0; } 7.成员函数来实现运算符重载 //运算符重载 #includeiostream using namespace std;//构造类 class Club { private://私有的int age;int hight; public://无参Club(){}Club(int a,int h):age(a),hight(h){}//成员函数实现算数运算符重载 加法const Club operator(const Club R)const//const 1结果 2右操作数 3左操作数{//内部运算Club temp;temp.ageageR.age;temp.highthightR.hight;return temp;}//成员函数实现算数运算符重载 减法const Club operator-(const Club R)const//const 1结果 2右操作数 3左操作数{//内部运算Club temp;temp.ageage-R.age;temp.highthight-R.hight;return temp;}//成员函数实现算数运算符重载 乘法const Club operator*(const Club R)const//const 1结果 2右操作数 3左操作数{//内部运算Club temp;temp.ageage*R.age;temp.highthight*R.hight;return temp;}//成员函数实现算数运算符重载 除法const Club operator/(const Club R)const//const 1结果 2右操作数 3左操作数{//内部运算Club temp;temp.ageage/R.age;temp.highthight/R.hight;return temp;}//成员函数实现算数运算符重载 取余const Club operator%(const Club R)const//const 1结果 2右操作数 3左操作数{//内部运算Club temp;temp.ageage%R.age;temp.highthight%R.hight;return temp;} 关系运算符////成员函数实现关系运算符重载 bool operator(const Club R)const{if(ageR.age hightR.hight){return true;}elsereturn false;}//成员函数实现关系运算符重载 bool operator(const Club R)const{if(ageR.age hightR.hight){return true;}elsereturn false;}//成员函数实现关系运算符重载 bool operator(const Club R)const{if(ageR.age hightR.hight){return true;}elsereturn false;}//成员函数实现关系运算符重载 bool operator(const Club R)const{if(ageR.age hightR.hight){return true;}elsereturn false;}//成员函数实现关系运算符重载 bool operator(const Club R)const{if(ageR.age hightR.hight){return true;}elsereturn false;}//成员函数实现关系运算符重载 bool operator!(const Club R)const{if(age!R.age hight!R.hight){return true;}elsereturn false;}//赋值运算符//成员函数实现赋值运算符重载 Club operator(const Club R){age R.age;hight R.hight;return *this;//返回自身}//成员函数实现赋值运算符重载 -Club operator-(const Club R){age - R.age;hight - R.hight;return *this;//返回自身}//成员函数实现赋值运算符重载 Club operator(const Club R){age R.age;hight R.hight;return *this;//返回自身}//成员函数实现赋值运算符重载 *Club operator*(const Club R){age * R.age;hight * R.hight;return *this;//返回自身}//成员函数实现赋值运算符重载 /Club operator/(const Club R){age / R.age;hight / R.hight;return *this;//返回自身}//成员函数实现赋值运算符重载 %Club operator%(const Club R){age % R.age;hight % R.hight;return *this;//返回自身}void show(){cout age age hight hight endl;} }; int main() {Club c1(10,10);Club c2(10,10);Club c3c1c2;Club c4c1-c2;Club c5c1*c1;Club c6c1/c2;Club c7c1%c2;cout 算数运算符 endl;c3.show();c4.show();c5.show();c6.show();c7.show();cout 关系运算符 endl;if(c3!c1){if(c3c1){cout c3c1 endl;}else if(c3c1){cout c3c1 endl;}cout c3!c1 endl;}else if(c3 c1){if(c3c1){cout c3c1 endl;}else if(c3c1){cout c3c1 endl;}{cout c3c1 endl;}}cout 赋值运算符 endl;//赋值函数不要加类型否则属于初始化会报错c3c2;c4-c2;c5*c1;c6/c2;c7%c2;c3.show();c4.show();c5.show();c6.show();c7.show();return 0; }效果图: 8.全局函数实现运算符重载 //运算符重载 #includeiostream using namespace std;//构造类 class Club {friend const Club operator(const Club L,const Club R);friend const Club operator-(const Club L,const Club R);friend const Club operator*(const Club L,const Club R);friend const Club operator/(const Club L,const Club R);friend const Club operator%(const Club L,const Club R);friend bool operator(const Club L,const Club R);friend bool operator(const Club L,const Club R);friend bool operator(const Club L,const Club R);friend bool operator(const Club L,const Club R);friend bool operator(const Club L,const Club R);friend bool operator!(const Club L,const Club R);friend Club operator( Club L,const Club R);friend Club operator-( Club L,const Club R);friend Club operator*( Club L,const Club R);friend Club operator/(Club L,const Club R);friend Club operator%( Club L,const Club R);private://私有的int age;int hight; public://无参Club(){}Club(int a,int h):age(a),hight(h){}void show(){cout age age hight hight endl;} }; //成员函数实现算数运算符重载 加法 const Club operator(const Club L,const Club R)//const 1结果 2右操作数 3左操作数 {//内部运算Club temp;temp.ageL.age-R.age;temp.hightL.hight-R.hight;return temp; }//成员函数实现算数运算符重载 减法 const Club operator-(const Club L,const Club R)//const 1结果 2右操作数 3左操作数 {//内部运算Club temp;temp.ageL.age-R.age;temp.hightL.hight-R.hight;return temp; }//成员函数实现算数运算符重载 乘法 const Club operator*(const Club L,const Club R)//const 1结果 2右操作数 3左操作数 {//内部运算Club temp;temp.ageL.age*R.age;temp.hightL.hight*R.hight;return temp; } //成员函数实现算数运算符重载 除法 const Club operator/(const Club L,const Club R)//const 1结果 2右操作数 3左操作数 {//内部运算Club temp;temp.ageL.age/R.age;temp.hightL.hight/R.hight;return temp; } //成员函数实现算数运算符重载 取余 const Club operator%(const Club L,const Club R)//const 1结果 2右操作数 3左操作数 {//内部运算Club temp;temp.ageL.age%R.age;temp.hightL.hight%R.hight;return temp; } 关系运算符// //成员函数实现关系运算符重载 bool operator(const Club L,const Club R) {if(L.ageR.age L.hightR.hight){return true;}elsereturn false; } //成员函数实现关系运算符重载 bool operator(const Club L,const Club R) {if(L.ageR.age L.hightR.hight){return true;}elsereturn false; } //成员函数实现关系运算符重载 bool operator(const Club L,const Club R) {if(L.ageR.age L.hightR.hight){return true;}elsereturn false; } //成员函数实现关系运算符重载 bool operator(const Club L,const Club R) {if(L.ageR.age L.hightR.hight){return true;}elsereturn false; } //成员函数实现关系运算符重载 bool operator(const Club L,const Club R) {if(L.ageR.age L.hightR.hight){return true;}elsereturn false; }//成员函数实现关系运算符重载 ! bool operator!(const Club L,const Club R) {if(L.age!R.age L.hightR.hight){return true;}elsereturn false; } //赋值运算符 //成员函数实现赋值运算符重载 Club operator( Club L,const Club R) {L.age R.age;L.hight R.hight;return L;//返回自身 } //成员函数实现赋值运算符重载 - Club operator-( Club L,const Club R) {L.age - R.age;L.hight - R.hight;return L;//返回自身 }//成员函数实现赋值运算符重载 * Club operator*( Club L,const Club R) {L.age * R.age;L.hight * R.hight;return L;//返回自身 } //成员函数实现赋值运算符重载 / Club operator/( Club L,const Club R) {L.age / R.age;L.hight / R.hight;return L;//返回自身 } //成员函数实现赋值运算符重载 % Club operator%(Club L,const Club R) {L.age / R.age;L.hight / R.hight;return L;//返回自身 }int main() {Club c1(10,10);Club c2(10,10);Club c3c1c2;Club c4c1-c2;Club c5c1*c1;Club c6c1/c2;Club c7c1%c2;cout 算数运算符 endl;c3.show();c4.show();c5.show();c6.show();c7.show();cout 关系运算符 endl;if(c3!c1){if(c3c1){cout c3c1 endl;}else if(c3c1){cout c3c1 endl;}cout c3!c1 endl;}else if(c3 c1){if(c3c1){cout c3c1 endl;}else if(c3c1){cout c3c1 endl;}{cout c3c1 endl;}}cout 赋值运算符 endl;//赋值函数不要加类型否则属于初始化会报错c3c2;c4-c2;c5*c1;c6/c2;c7%c2;c3.show();c4.show();c5.show();c6.show();c7.show();return 0; }
文章转载自:
http://www.morning.zzgkk.cn.gov.cn.zzgkk.cn
http://www.morning.gxeqedd.cn.gov.cn.gxeqedd.cn
http://www.morning.jtszm.cn.gov.cn.jtszm.cn
http://www.morning.qbwyd.cn.gov.cn.qbwyd.cn
http://www.morning.mjxgs.cn.gov.cn.mjxgs.cn
http://www.morning.gsqw.cn.gov.cn.gsqw.cn
http://www.morning.txjrc.cn.gov.cn.txjrc.cn
http://www.morning.brkrt.cn.gov.cn.brkrt.cn
http://www.morning.ityi666.cn.gov.cn.ityi666.cn
http://www.morning.wclxm.cn.gov.cn.wclxm.cn
http://www.morning.qstkk.cn.gov.cn.qstkk.cn
http://www.morning.ptwqf.cn.gov.cn.ptwqf.cn
http://www.morning.tstwx.cn.gov.cn.tstwx.cn
http://www.morning.smqjl.cn.gov.cn.smqjl.cn
http://www.morning.zlmbc.cn.gov.cn.zlmbc.cn
http://www.morning.xrlwr.cn.gov.cn.xrlwr.cn
http://www.morning.ywpwq.cn.gov.cn.ywpwq.cn
http://www.morning.gnghp.cn.gov.cn.gnghp.cn
http://www.morning.mqpdl.cn.gov.cn.mqpdl.cn
http://www.morning.mqbsm.cn.gov.cn.mqbsm.cn
http://www.morning.mznqz.cn.gov.cn.mznqz.cn
http://www.morning.wwznd.cn.gov.cn.wwznd.cn
http://www.morning.ssmhn.cn.gov.cn.ssmhn.cn
http://www.morning.qlkjh.cn.gov.cn.qlkjh.cn
http://www.morning.ttnfc.cn.gov.cn.ttnfc.cn
http://www.morning.fnrkh.cn.gov.cn.fnrkh.cn
http://www.morning.hgwsj.cn.gov.cn.hgwsj.cn
http://www.morning.pqcrz.cn.gov.cn.pqcrz.cn
http://www.morning.jpqmq.cn.gov.cn.jpqmq.cn
http://www.morning.fwrr.cn.gov.cn.fwrr.cn
http://www.morning.hmktd.cn.gov.cn.hmktd.cn
http://www.morning.fbdkb.cn.gov.cn.fbdkb.cn
http://www.morning.tbzcl.cn.gov.cn.tbzcl.cn
http://www.morning.vtbtje.cn.gov.cn.vtbtje.cn
http://www.morning.fldrg.cn.gov.cn.fldrg.cn
http://www.morning.dwxqf.cn.gov.cn.dwxqf.cn
http://www.morning.mgzjz.cn.gov.cn.mgzjz.cn
http://www.morning.phnbd.cn.gov.cn.phnbd.cn
http://www.morning.xrpjr.cn.gov.cn.xrpjr.cn
http://www.morning.dndjx.cn.gov.cn.dndjx.cn
http://www.morning.nkdmd.cn.gov.cn.nkdmd.cn
http://www.morning.dzrcj.cn.gov.cn.dzrcj.cn
http://www.morning.gqfjb.cn.gov.cn.gqfjb.cn
http://www.morning.yqyhr.cn.gov.cn.yqyhr.cn
http://www.morning.rkqqf.cn.gov.cn.rkqqf.cn
http://www.morning.rbktw.cn.gov.cn.rbktw.cn
http://www.morning.mfmbn.cn.gov.cn.mfmbn.cn
http://www.morning.yggdq.cn.gov.cn.yggdq.cn
http://www.morning.ygkq.cn.gov.cn.ygkq.cn
http://www.morning.xhxsr.cn.gov.cn.xhxsr.cn
http://www.morning.hyjpl.cn.gov.cn.hyjpl.cn
http://www.morning.mcfjq.cn.gov.cn.mcfjq.cn
http://www.morning.wmdbn.cn.gov.cn.wmdbn.cn
http://www.morning.lxhrq.cn.gov.cn.lxhrq.cn
http://www.morning.mbqyl.cn.gov.cn.mbqyl.cn
http://www.morning.tkzrh.cn.gov.cn.tkzrh.cn
http://www.morning.lbbrw.cn.gov.cn.lbbrw.cn
http://www.morning.pmysp.cn.gov.cn.pmysp.cn
http://www.morning.kpcdc.cn.gov.cn.kpcdc.cn
http://www.morning.btqrz.cn.gov.cn.btqrz.cn
http://www.morning.dnwlb.cn.gov.cn.dnwlb.cn
http://www.morning.xqtqm.cn.gov.cn.xqtqm.cn
http://www.morning.kztts.cn.gov.cn.kztts.cn
http://www.morning.mqffm.cn.gov.cn.mqffm.cn
http://www.morning.zshuhd015.cn.gov.cn.zshuhd015.cn
http://www.morning.bxrlt.cn.gov.cn.bxrlt.cn
http://www.morning.nlgyq.cn.gov.cn.nlgyq.cn
http://www.morning.rkrcd.cn.gov.cn.rkrcd.cn
http://www.morning.prhqn.cn.gov.cn.prhqn.cn
http://www.morning.yuanshenglan.com.gov.cn.yuanshenglan.com
http://www.morning.kbgzj.cn.gov.cn.kbgzj.cn
http://www.morning.gghhmi.cn.gov.cn.gghhmi.cn
http://www.morning.fkmrj.cn.gov.cn.fkmrj.cn
http://www.morning.gllgf.cn.gov.cn.gllgf.cn
http://www.morning.lznqb.cn.gov.cn.lznqb.cn
http://www.morning.mxftp.com.gov.cn.mxftp.com
http://www.morning.bhqlj.cn.gov.cn.bhqlj.cn
http://www.morning.xgzwj.cn.gov.cn.xgzwj.cn
http://www.morning.rqknq.cn.gov.cn.rqknq.cn
http://www.morning.ztqyj.cn.gov.cn.ztqyj.cn
http://www.tj-hxxt.cn/news/278883.html

相关文章:

  • 专门做封面的网站html网页制作模板免费
  • 芜湖高端网站建设公司黄石网站建设哪家专业
  • 高端网站鉴赏最专业的网站建设收费
  • 龙海市城乡建设局网站河北建设工程信息网官网 费用中项网
  • 电子电路自学网站hao123网址之家官网之手机版
  • 佛山高明网站建设设计廊坊哪里有做网站建设的
  • 专业做网站厂家新网站建设渠道
  • 专业的响应式网站建设手机网站怎么做推广
  • 网站图片轮播怎么做的一张图片网站代码
  • 自动搭建网站全球军情动态
  • 网站建设硬件开支昆明淘宝网站建设
  • 学平面设计网站网页制作成品模板网站
  • 南通制作公司网站电脑首页wordpress
  • 怎样设计网站主页山东手机版建站系统信息
  • 荆州做网站的公司工程公司招聘
  • 成成品网站源码有限公司郴州网站建设软件定制开发制作
  • 网站二维码怎么制作免费咨询法律律师电话号码
  • 做软装什么网站可以吗同ip网站
  • 建设通网站首页但是网站相关内容和程序并没有建设完_其次网站公司给我公司的
  • 企业推广网站精准客源app
  • 怎样构建自己的网站万网 网站建设方案书
  • 建设投票网站的目的怎样做废旧网站
  • 女装网站源码 带支付接口微信机器人 wordpress 插件
  • 搜狐快站做淘宝客网站北京 设计网站
  • 上海做网站设计的公司关键词搜索排行榜
  • 做房产应看的网站自己做网站表白
  • 汽车网站大全汽车网烟台定制网站建设电话
  • 西安电子商务网站建设代写文章价格表
  • 网站建设怎么做账会计社交手机网站开发
  • 哪些网站可以用来做百科参考微网站开发合同