#include<iostream>
struct box
{
char maker[40];
float height;
float width;
float length;
float volume;
};
void show(box b);
void show(box *b);
//void show(box &b);
using std::cout;
using std::endl;
void main()
{
box b={"aaa",3,4,5,0};
show(b);
show(&b);
system("pause");
}
void show(box b)
{
cout<<b.maker<<endl;
cout<<b.height<<endl;
cout<<b.width<<endl;
cout<<b.length<<endl;
cout<<b.volume<<endl;
}
void show(box *b)
{
b->volume=b->length*b->height*b->width;
cout<<b->height<<endl;
cout<<b->length<<endl;
cout<<b->width<<endl;
cout<<b->volume<<endl;
}
7.3
最新推荐文章于 2022-12-15 20:44:38 发布