错误 - 函数定义中的 'expected primary expression before...' (C++)

error - 'expected primary expression before...' in function definition (C++)

尝试 运行 在在线编译器中执行此操作时出现错误 - 'expected primary expression before '。' ' 在所有 4 个结构成员的函数定义中:高度、宽度、长度、体积。在 Visual studio 中,错误是 ' 'box' 非法使用此类型作为表达式。可能是什么原因?

#include <iostream>

using namespace std;

struct box

  {

      float height;
      float width;
      float length;
      float volume;
  };


void display(box amazon);

int main()

{
    box amazon

    {
         10, 10, 10, 10
    };

    display(amazon);

    return 0;

}

   void display(box amazon)

    {
        cout<<"Box height: "<<box.height;
        cout<<"Box width: "<<box.width<<"Box length: "<<box.length<<"Box volume: "<<box.volume;
    }

display函数中你必须改变box,这是类型,amazon是对象

       void display(box amazon)
    
        {
            cout<<"Box height: "<<amazon.height;
            cout<<"Box width: "<<amazon.width<<"Box length: "<<amazon.length<<"Box volume: "<<amazon.volume;
        }