C++编程作业:求两数和,求矩形和圆面积,求阶乘n!
一,求两数之和
#include class Add
{
private:
int x,y;
public:
void Get(int x1,int y1)
{
x=x1;
y=y1;
};
void add(int x,int y)
{
cout<<"x+y = "<>a;
b.Area(a);
b.V(a);
}
三,求圆的面积和周长
#include class Circle
{private:
int r;
public:
void Get(int r1)
{r=r1;};
void Area(int r)
{cout<<"Area = "<<3.14*r*r<>r;
c.Area(r);
c.C(r);
}
四,求n~
#include class Jie
{
private:
int n;
public:
Jie(int n1)
{
n=n1;
}
void fun(int n)
{int i;
for(i=n-1;i>=1;i--)
n=n*i;
cout<<" n! = "< class Area1
{private:
int x;
public:
Area1(int x1)
{x=x1;}
Area1(const Area1 &p)
{x=p.x;}
float area1(int x)
{return 3.14*x*x;}
};
class Area2
{private:
int a,b;
public:
Area2(int a1,int b1)
{a=a1;b=b1;}
Area2(const Area2 &q)
{a=q.a;b=q.b;}
int area2(int a,int b)
{return a*b;}
};
void main()
{float sum1,sum2;
Area1 r(15);
sum1=r.area1(15)+r.area1(23)+r.area1(37);
cout<<"sum1 = "<
本文档为【C++编程作业:求两数和,求矩形和圆面积,求阶乘n!】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。