#include
#include
using namespace std;
struct box
{
char maker[40];
float height;
float width;
float length;
float volume;
};
void pass_value(box);
void pass_adress(box*);
int main()
{
box* ps = new box;
ps->height = (*ps).width = ps->length = 10;
char word[] = "the world";
strcpy_s(ps->maker, word);
pass_value(*ps);
pass_adress(ps);
delete ps;
return 0;
}
void pass_value(box box_s)
{
cout << "maker: " << box_s.maker << endl;
cout << "height: " << box_s.height << endl;
cout << "width: " << box_s.width << endl;
cout << "length: " << box_s.length << endl<<endl;
}
void pass_address(box* pt)
{
cout << "volume= " << (pt->height)*(pt->width)*(pt->length) << endl;
}
错误在哪里?求解答
address少了个d
上面的图不清晰,重发源代码
函数原型和调用那里都没拼对