已阅读5页,还剩15页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
作业1:输入两个变量,输出两个变量的最大值。要求:使用C+语言,使用max函数完成求最大值的操作。#includeintmax(intx,inty)return(xy?x:y);intmain(intargc,char*argv)inta,b;coutab;couta;return0;作业2:(1)输入下列简单C+程序,完成编译、连接、运行,熟悉C+程序的开发过程。#includeusingnamespacestd;constfloatPI=3.1416;voidmain() intiType;floatradius,a,b,area;coutiType;switch(iType)case1:coutradius;area=PI*radius*radius;couta;coutb;area=a*b;couta;area=a*a;coutusingnamespacestd;constdoublePI=3.1416;inlinefloatcirlearea(float);inlinefloatrectarea(float);inlinefloatzrectarea(float);voidmain() intiType;floatradius,a,b,area;coutiType;switch(iType)case1:coutradius;area=cirlearea(radius);couta;coutb;area=a*b;couta;area=a*a;coutusingnamespacestd;constdoublePI=3.1416;inlinefloatcirlearea(float,float);inlinefloatrectarea(float,float);inlinefloatzrectarea(float,float);voidmain() intiType;floatradius,a,b,area;float(*carea)(float,float);coutiType;switch(iType)case1:carea=cirlearea;coutradius;area=(*carea)(radius,a=0);couta;coutb;area=(*carea)(a,b);couta;area=(*carea)(a,a);coutusingnamespacestd;classRectprivate:intlength;intwidth;intperim;public:Rect() length=10;width=10;Rect(intlength,intwidth) this-length=length;this-width=width;voidsetLength(intlength) if(length0else cout0else coutusingnamespacestd;enumcpu_wordlenW16,W32,W64,W128,W256;classCPUpublic:CPU()frequency=0;wordlength=W16;coefficient=0;coutclasspointintx,y;public:point(inta,intb)x=a;y=b;cout#includeusingnamespacestd;classStudentpublic:Student(char*,int,bool);Student(constStudentStudent();Studentvoidprint();private:char*name;intage;boolsex;intlen;Student:Student(char*name,intage,boolsex)len=strlen(name);this-name=newcharlen+1;strcpy(this-name,name);this-age=age;this-sex=sex;Student:Student(constStudentthis-name=newcharlen+1;strcpy(this-name,);this-age=stu.age;this-sex=stu.sex;Student:Student()len=0;deletename;Studentthis-name=newcharlen+1;strcpy(this-name,);this-age=stu.age;this-sex=stu.sex;return*this;voidStudent:print()cout#includeclassCMelonSalepublic:CMelonSale(floatvWeight)m_Weight=vWeight;m_TotalWeight+=m_Weight;m_WeightStore.push_back(m_Weight);m_TotalNum+;CMelonSale()m_TotalNum-;staticvoidto
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 应急预案逃生方法(3篇)
- 创意昆虫活动方案策划(3篇)
- 换热器应急预防预案(3篇)
- 围棋美术活动方案策划(3篇)
- 2025中国农业大学张芸教授诚聘博士后模拟笔试试题及答案解析
- 2026广东佛山市高明区招聘中学教师74人(第二场编制)备考考试试题及答案解析
- 2026年安全员B证理论试题及解析
- 2025江西吉安遂川县城控人力资源管理有限公司招聘工作人员部分岗位改报及延期模拟笔试试题及答案解析
- 2025北京建工一建招聘参考考试题库及答案解析
- 2026湖南长沙浏阳市石齐学校教师招聘22人备考笔试题库及答案解析
- 重症凝血病标准化评估中国专家共识(2025版)
- 2025年铲车理论考试及答案
- 十五五特殊教育发展提升行动计划
- 硅冶炼故障原因剖析分析报告
- 编制说明-《生物类实验室空间设计指南》
- 2025年《3~6岁儿童学习与发展指南》测试卷(附答案)
- 原料采购定价管理办法
- 供电公司安全培训
- 不合格食品管理制度
- QGDW10384-2023输电线路钢管塔加工技术规程
- 咖啡店5s管理制度
评论
0/150
提交评论