接收错误变量具有不完整的类型“void”

use*_*644 6 c++ variables types void

我正在编写一个基本的 C++ 程序来计算一条线的长度和斜率。用户输入一组 x 和 y 坐标点,然后程序会显示一个菜单,询问用户他/她是否只想计算斜率、仅计算长度,或同时计算斜率和长度。但是,我的 void Menu 函数出现错误,指出该变量具有不完整的类型“void”。我现在的代码如下。

#include <iostream>
#include <cmath>

void Menu (int& MenuNum);
void CalculateSlope (int& X1, int& X2, int& Y1, int& Y2);
void CalculateLength (int& X1, int& X2, int& Y1, int& Y2);

using namespace std;

int main(int argc, const char * argv[])
{

    int X1;
    int X2;
    int Y1;
    int Y2;
    int MenuNum;
    //Ask User for Points

    cout << "Enter points (X1,Y1) and (X2,Y2) for the line." << endl;
    cout << " " << endl;
    cout << "X1:" << endl;
    cin >> X1;
    cout << "Y1:" << endl;
    cin >> Y1;
    cout << "X2:" << endl;
    cin >> X2;
    cout << "Y2:" << endl;
    cin >> Y2;

    cout << "Points entered are" 
         << " : " << X1 << "," 
         << Y1 << " and " 
         << X2 << "," << Y2 << endl;
    cout << "                  "<< endl;

    //Menu

    void Menu (MenuNum);
    {
        cout << "To calculate the slope of the line, enter 1 " << endl;
        cout << "To calculate the length of the line, enter 2" << endl;
        cout << "To calculate the length and slope of the line, enter 3" << endl;
        cin >> MenuNum;

    }
Run Code Online (Sandbox Code Playgroud)

此外,如果您能就如何从 Menu 函数调用斜率和长度计算函数提供一些指导,那就太好了。

谢谢!

use*_*851 0

函数名称末尾有一个分号