#include <iostream>
using namespace std;
struct box{
char maker[40];
float height;
float width;
float length;
float volume;
};
void show(box x);
box xie(box x);
int main(){
box temp;
box xi=xie(temp);
show(xi);
}
void show(box x){
cout << "\nThe maker of the box is " << x.maker << "." << endl;
cout << "The height of the box is " << x.height << "." << endl;
cout << "The width of the box is " << x.width << "." << endl;
cout << "The length of the box is " << x.length << "." << endl;
cout << "The volume of the box is " << x.volume << "." << endl;
}
box xie(box x){
box xt=x;
cout << "The following is the example box."<<endl;
cout << "Please enter the box maker: ";
cin >> xt.maker;
cout << "Please enter the height: ";
cin >> xt.height;
cout << "Please enter the width: ";
cin >> xt.width;
cout << "Please enter the length: ";
cin >> xt.length;
cout << "Please enter the volume: ";
cin >> xt.volume;
return xt;
}
原图: