【发布时间】:2020-08-31 13:14:19
【问题描述】:
我对编程完全陌生,我正在学习 C++。我写了一个代码来练习带返回值的函数。代码构建并运行,但有一条错误消息,我需要一些帮助来理解它。
#include <iostream>
using namespace std;
void showMenu() {
cout << " 1. Change personal information." << endl;
cout << " 2. Search a Record." << endl;
cout << " 3. Delete a Record." << endl;
cout << " " << endl;
}
int getInput() {
cout << "Please select a menu item: " << flush;
int menuNum;
cin >> menuNum;
return menuNum;
}
void processSelection (int options){
int password = 12;
int record = 4;
int record2 = 5;
switch (options) {
case 1:
...
}
int main() {
cout << "" << endl;
showMenu();
int menuSel = getInput();
processSelection (selection);
return 0;
}
我省略了所有开关的东西,因为它占用了太多空间。 错误在 int main() at processSelection(selection);它说“无法解决类型'processSelection'。”
谢谢
【问题讨论】:
-
您可能想将
menuSel而不是选择传递给processSelection函数