c++ - 菜单选择错误,找不到任何解决方案。未找到菜单标识符
问题描述
我有一个问题,我是 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;
}
解决方案
您不需要为select()
看似返回任何东西。你应该声明main()
并在那里写:
.
select();
.
重要提示:您尚未为menu()
. 在代码的开头,只需添加一行int menu();
就可以了。
推荐阅读
- php - PHP:如何用单引号和双引号分配大字符串
- gem5 - 自定义内核之间的 L2 缓存共享
- javascript - 缓慢的第三方 API 阻塞 Express 服务器
- python - 如何通过 socks 代理访问 Azure Blob 存储?
- linear-programming - 如何解决 mathprog 中的域外错误?
- python-3.x - 在 Dash/Plotly 中显示 PIL 图像
- javascript - 在反应路由器中切换页面时未加载js文件
- netsuite - Netsuite - 发送电子邮件操作按钮不起作用
- r - 如何在 visNetwork 中显示非彩色图形且易于阅读的文本?
- python - Pyspark + Anaconda 上的 IllegalArgumentException