/*
*Corpyright (c)2013,烟台大学计算机学院
*All right reseved.
*作者:z张梦佳
*完成日期:2014年3月11日
*版本号:v1.0
*输入描述:
*问题描述:输入三个长方体的长宽高,输出表面积和体积!
*程序输出:
*问题分析:
*算法设计:
*/
#include <iostream>
using namespace std;
class time
{
public:
double area(double,double,double);
double tj1(double,double,double);
void shuru();
void shuchu();
private:
double ch;
double k;
double high;
};
void time::shuchu()
{
cout<<area(ch,k,high)<<endl;
cout<<tj1(ch,k,high)<<endl;
}
void time::shuru()
{
cin>>high>>k>>ch;
}
double time::area(double a,double s,double d)
{
double sss;
sss=(a*s+s*d+d*a)*2;
return sss;
}
double time::tj1(double a,double s,double d)
{
double ssss;
ssss=a*s*d;
return ssss;
}
int main()
{
time t[3];
cout<<"请输入三个长方体的长宽高!"<<endl;
for(int i=0;i<3;i++)
{
cout<<"请输入第"<<i+1<<"个长方体的长宽高!"<<endl;
t[i].shuru();
}
for(int i=0;i<3;i++)
{
cout<<"第"<<i+1<<"个长方体的表面积和体积分别为:"<<endl;
t[i].shuchu();
}
return 0;
}
感悟:
那啥,俺有对象了!