已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 厦门大学哲学系2025年工程、实验系列专业技术中初级职务人员招聘备考题库附答案详解
- 2026软件测试招聘题库及答案
- 2025-2026学年纸杯风车美术教案
- 2019教科版三年级上册科学教案(全册)
- 2025-2026学年小班种子分类教案
- 2025-2026学年蜜蜂教学设计图制作教程
- 电池厂停水应急制度
- 2025-2026学年军神教案试讲
- 2025-2026学年种葫芦音乐教学设计模版
- 2025-2026学年自锁电路教案
- 古代青铜铸造技术
- 廉洁从业宣教培训手册
- 伤寒课件教学课件
- 建设用地报批服务投标方案
- 环境监测系毕业论文
- 09-幽门螺旋杆菌健康宣教
- 消防驾驶员安全驾驶课件
- 城市地下管网建设实施方案
- 智能采矿技术课件
- 《实践论》《矛盾论》导读课件
- 毕业设计(论文)-包裹分拣机械结构设计
评论
0/150
提交评论