我不理解如何使它在testSelection中輸入我的選擇時指向功能測試。我如何去做這件事?它不應該去那裏嗎?Cin和指向功能選擇
#include <iostream>
using namespace std;
int test (int testSelection);
int main()
{
int testSelection;
cout << "Welcome to the pizza place!" << endl;
cout << "Choose 1 for pizza or 2 for drinks: ";
cin >> testSelection;
return 0;
}
int test (int testSelection)
{
if (testSelection== 1)
{
cout << "select your Pizza" << endl;
}
if (testSelection== 2)
{
cout << "Please select your drink" << endl;
}
else
cout << "test";
return 0;
}