I am not understanding how to make it so when i input my selection in testSelection for it to point to the function test. How do i go about doing this? Shouldn’t it just go there?
#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;
}
You need to call the function…
Basically, you’ve written a function definition int test(int testSelection) {…code…} but, it’s just dormant code until you invoke it by calling it.