# 笨熊的盒子

#include <iostream>
using namespace std;
struct Box
{
int height;
int width;
int length;
};
void input(Box b[], int n);
int volume(Box b);
int main( )
{
Box a[3];
int i;
input(a,3);
for(i=0;i<3;i++)
cout<<"volume of a["<<i<<"] is "<<volume(a[i])<<endl;
return 0;
}
//下面定义需要的函数，只提交下面的程序

``````10 12 15
15 18 20
16 20 26``````

``````volume of a[0] is 1800
volume of a[1] is 5400
volume of a[2] is 8320``````

``````#include<stdio.h>
int main()
{
int i,j,a[3][3],sum;
for(i=0;i<=2;i++)
for(j=0;j<=2;j++)
scanf("%d",&a[i][j]);
for(i=0;i<=2;i++)
{
sum=1;
for(j=0;j<=2;j++)
sum=sum*a[i][j];
printf("volume of a[%d] is %d\n",i,sum);
}
return 0;
}``````

``````#include <iostream>
using namespace std;

struct Box{
int height;
int width;
int length;
};
void input(Box[], int);
int volume(Box b);

int main( ){
Box a[3];
int i;
input(a,3);
for(i=0;i<3;i++)
cout<<"volume of a["<<i<<"] is "<<volume(a[i])<<endl;
return 0;
}

void input(Box a[], int n)
{
int i;
for(i=0;i<n;i++)
{
cin>>a[i].height>>a[i].width>>a[i].length;
}
}

int volume(Box b)
{
return b.height*b.length*b.width;
}
``````