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

web网站开发历史新闻实时报道

web网站开发历史,新闻实时报道,怎么接网站来做,试用网站模版定义一个Person类,私有成员int age,string &name,定义一个Stu类,包含私有成员double *score,写出两个类的构造函数、析构函数、拷贝构造和拷贝赋值函数,完成对Person的运算符重载(算术运算符、条件运算…

定义一个Person类,私有成员int age,string &name,定义一个Stu类,包含私有成员double *score,写出两个类的构造函数、析构函数、拷贝构造和拷贝赋值函数,完成对Person的运算符重载(算术运算符、条件运算符、逻辑运算符、自增自减运算符、插入/提取运算符)

#include <iostream>using namespace std;class person
{int age;string &name;
public:person(string &a):age(18),name(a){}person(int a,string &b):age(a),name(b){}~person(){}person(const person &other):age(other.age),name(other.name){}person &operator=(const person&other){this->age=other.age;this->name=other.name;return *this;}void show(){cout<<"age:"<<age<<endl<<"name:"<<name<<endl;}person operator+(const person&other){int age=this->age+other.age;static string name;name = this->name+other.name;return person(age,name);}bool operator==(person &other){if((this->age==other.age)&&(this->name==other.name))return true;elsereturn false;}bool operator>(person &other){if(this->age>other.age)return true;elsereturn false;}bool operator&&(person &other){return (this->age&&other.age)||(this->name==other.name);}int getage(){return age;}friend ostream &operator<<(ostream &out,person&c1);friend istream &operator>>(istream &in,person &c1);
};
ostream &operator<<(ostream &out,person&c1)
{out<<"age:"<<c1.age<<endl<<"name:"<<c1.name<<endl;return out;
}
istream &operator>>(istream &in,person &c1)
{in>>c1.age>>c1.name;return in;
}
class stu
{double *score;person p1;
public:stu(string &a):score(new double(12.5)),p1(a){}stu(double a,string &b):score(new double(a)),p1(b){}~stu(){delete score;}stu(const stu&other):score(new double(*(other.score))),p1(other.p1){}stu &operator=(const stu&other){*(this->score)=*(other.score);this->p1=other.p1;return *this;}void show(){cout<<"score:"<<*score<<endl;p1.show();}
};
int main()
{string a="zhangsan";string b="lisi";string c="wangwu";stu a1(a);a1.show();cout<<endl;person p1(a);cout<<p1<<endl;person p2(b);cout<<p2<<endl;person p3(c);cout<<p3<<endl;person p4=(p1+p2);p4.show();cout<<endl;cout<<(p1==p2)<<endl;cout<<(p1>p2)<<endl;cout<<(p1&&p2)<<endl;return 0;
}

http://www.dinnco.com/news/9614.html

相关文章:

  • 公司换网站换域名 备案贵港seo关键词整站优化
  • 长子营网站建设网络推广是什么
  • 个人网站开发软件seo关键词排名优化教程
  • 个人网页制作成品免费下载百度seo自动优化
  • 青岛哪家做网站的公司seo社区
  • 利用js做网站阿拉善盟seo
  • 做网站一般像素互联网广告平台代理
  • 网站上社保做增员怎么做重庆seo团队
  • 网站制作一般要几天全网线报 实时更新
  • 有服务器怎么做网站教程公众号排名优化
  • wordpress 积分购物seo自动优化工具
  • php自己做网站访问量计算免费下载app并安装
  • 凡科建站手机网站建设青岛网站制作seo
  • 小卖部做网站一键生成网站
  • 做酒店网站百度推广公司哪家比较靠谱
  • 网站定制设计网页价格多少钱网站优化seo是什么意思
  • wordpress获取子菜单seo排名计费系统
  • 武汉眼前一亮科技有限公司青岛seo整站优化招商电话
  • 张家港做网站费用内容企业推广
  • 深圳网站快速排名优化b站视频推广网站动漫
  • 怎样建设一个公司网站南京市网站
  • wordpress内网使用深圳网络seo推广
  • 不用ftp做网站seo内容优化心得
  • 网站前台界面模板下载网易搜索引擎入口
  • 济南网站建设 泉诺网站推广平台
  • 网站备案需要准备哪些资料主要推广手段免费
  • 做网站一定要有营业执照吗百度搜索排名查询
  • php网站开发教程网seo外链代发
  • 可以做动图的视频网站产品推广介绍怎么写
  • 广告位seo关键词排名优化的方法