用C 定义一个圆的类,计算其周长和面积
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/12 09:30:36
用java语言描述:publicclassCircle{privatedoubleRadius;//半径publicCircle(){}publicCircle(doubleradius){Radiu
#include#includeusingnamespacestd;intmain(){constfloatPI=3.1416f;floatr;cin>>r;floatc=2*PI*r;fl
周长:形成整个圆的那条曲线的长度叫圆的周长.面积:组成员的那条曲线中的面积,就是圆的面积.
回楼主#include#definePI3.1415926intmain(){doubler,l,s;printf("请输入半径:");scanf("%lf",&r);if(
classCircle{\x09privatedoubler;\x09publicvoidsetR(doubler)\x09{\x09\x09this.r=r;\x09}\x09publicdoubl
namespaceEX1_4{publicclassshape{publicdoublePI=3.14;}publicclassRectangle:shape{publicintx,y,s,l;pub
#include#includeusingnamespacestd;classCircle{doubler,Area,Circumference;public:Circle(doublea=0);Ci
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceConsoleApplic
Java的行不,C++的不记得了.publicclassCircle{privatestaticdoublePI=3.14privatedoubleradius;publicCircle(double
#includeclassCircle{public:Circle():radius(0){}Circle(doubler):radius(r){}constdoublearea()co
以下程序,直接拿去交作业吧,都测试过了.//圆周长面积#include#definepi3.14159classcircle{public:voidsetRadius(){std::cout
类似的问题,在知道里面不知道有多少.搜索一下.
classTriangle{private:\x05doublea;\x05doubleb;\x05doublec;public:\x05Triangle():a(0),b(0),c(0){}\x05
#include"stdafx.h"#include#includeusingnamespacestd;classCircle{doubler,Area,Circumference;public:Ci
usingSystem;classRectangle{privateintwidth;privateintheight;publicRectangle(intw,inth){width=w;heigh
#includeusingnamespacestd;classCircle{public:Circle(doubler=0):radius(r){}doubleArea(){return3.14*ra
classcircle{doublerd;//半径成员public:circle(){rd=0.0;}//构造函数cirle(doubleb){rd=b;}//重构构造函数doublezc(){ret
不要提出这种问题,代码还是自己动手写的好,写的过程中遇到麻烦,再拿出来问的话,我想会有更多人乐意帮你解答的再问:来不及哦!!今天晚上要交!!没时间慢慢写!!我对c++也不是很熟!急求高手流利的给个程序
#include#include#includeusingnamespacestd;classTriangle{inta,b,c;public:doubleArea(){doubles=(a+b+c)
sorry我不会啊