没有合适的资源?快使用搜索试试~ 我知道了~
定义一个矩形类有输入界面输入长宽高可以算出体积
资源推荐
资源详情
资源评论
#include <iostream>
using namespace std;
class box
{
private:
float length;
float width;
float height;
public:
box(float a,float b,float c);
void volume();
};
box::box(float a,float b,float c)
{
length=a;
width=b;
height=c;
}
void box::volume()
{
cout<<"长方体的体积是:"<<length*width*height<<endl;
}
void main()
{
float a,b,c;
cout<<"请输入长方体的长:";
cin>>a;
cout<<"请输入长方体的宽:";
cin>>b;
using namespace std;
class box
{
private:
float length;
float width;
float height;
public:
box(float a,float b,float c);
void volume();
};
box::box(float a,float b,float c)
{
length=a;
width=b;
height=c;
}
void box::volume()
{
cout<<"长方体的体积是:"<<length*width*height<<endl;
}
void main()
{
float a,b,c;
cout<<"请输入长方体的长:";
cin>>a;
cout<<"请输入长方体的宽:";
cin>>b;
资源评论
cxm1245
- 粉丝: 0
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功