首页 > 解决方案 > 菜单选择错误,找不到任何解决方案。未找到菜单标识符

问题描述

我有一个问题,我是 C++ 新手,并且对编码很熟悉。我有这个问题我现在正在为游戏编写一个加载器并想要制作一个选择菜单。我有这个错误,我不知道如何解决它。如果你能帮助我会很高兴。

这是我的代码https://ghostbin.co/paste/x8hz3

int DLL();
int Beta();

int select()
{
    int selection;
    do
    {
        selection = menu();
        switch (selection)
        {
        case 1:    DLL();
            break;
        case 2:    Beta();
            break;  cout << "Exiting program.\n\n\n";  
        }
    } while (selection != 2);
    return 0;
}

int menu()
{
    int choice;
    cout << "Loader menu\n";
    cout << "--------------------------------\n";
    cout << "Normal\n";
    cout << "--------------------------------\n";
    cout << "1) Beta\n";
    cout << "--------------------------------\n";
    cout << "2) Dll methods\n";


    cin >> choice;
    while (choice < 1 || choice > 2)  // Check to see if user's input is correct
    {
        cout << "Invalid Selection. Enter 1, or 2: ";
        cin >> choice;
    }
    return choice;
}

int DLL()
{

    cout << "Test" << endl;

}

int Beta()
{

    cout << "Test" << endl;

}

标签: c++

解决方案


您不需要为select()看似返回任何东西。你应该声明main()并在那里写:

.
select();
.

重要提示:您尚未为menu(). 在代码的开头,只需添加一行int menu();就可以了。


推荐阅读