33,321
社区成员




#include<iostream>
#include<cmath>
struct box
{
char maker[40];
float height;
float width;
float length;
float volume;
};
const void show(box info);
box calculate (box *info);
const void show(box info,box info1)
{
using namespace std;
cout<<"The maker of the box is: "<<info1.maker<<endl;
cout<<"The height of the box is: "<<info1.height<<endl;
cout<<"The length of the box is: "<<info1.length<<endl;
cout<<"The volume of the box is: "<<info.volume<<endl;
}
box caculate (box *info)
{
box result;
result.volume=info->height*info->length*info->width;
return result;
}
int main()
{
using namespace std;
box info;
box result;
cout<<"Please enter the maker, height, width, and length of the box respectly"
<<endl;
cin.getline(info.maker,40);
cin>>info.height;
cin>>info.width;
cin>>info.length;
result=calculate(&info);
show(result,info);
return 0;
}