欢迎来到天天文库
浏览记录
ID:14198951
大小:27.50 KB
页数:3页
时间:2018-07-26
《c++编程:求矩形面积、找质数并求和、求阶乘》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、1.求矩形面积:(1)给定数据:#includeusingnamespacestd;classRect{public:Rect(float,float);voidArea(Rect&);floatchang;floatkuan;};Rect::Rect(floatc,floatk):chang(c),kuan(k){}voidArea(Rect&r){cout<2、m>usingnamespacestd;classRect{public:Rect(){chang=0.0;kuan=0.0;}Input();Area();private:floatchang;floatkuan;};Rect::Input(){cin>>chang>>kuan;}Rect::Area(){cout<usingnamespacest3、d;intisprime(intn){inti;for(i=2;iusingnamespacestd;classJi{public:voidInput();intji();intn;};voidJi::Input(){cin>>n;}intJi::4、ji(){inti,jie=1;for(i=1;i<=n;i++){jie*=i;}returnjie;}intmain(){Jij1;cout<<"pleaseinputn:";j1.Input();cout<<"10!="<
2、m>usingnamespacestd;classRect{public:Rect(){chang=0.0;kuan=0.0;}Input();Area();private:floatchang;floatkuan;};Rect::Input(){cin>>chang>>kuan;}Rect::Area(){cout<usingnamespacest
3、d;intisprime(intn){inti;for(i=2;iusingnamespacestd;classJi{public:voidInput();intji();intn;};voidJi::Input(){cin>>n;}intJi::
4、ji(){inti,jie=1;for(i=1;i<=n;i++){jie*=i;}returnjie;}intmain(){Jij1;cout<<"pleaseinputn:";j1.Input();cout<<"10!="<
此文档下载收益归作者所有