7.3

#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;
}

阅读更多

没有更多推荐了,返回首页