+ 1
User Select from Array (C++)
I used to know how this worked but have completely forgotten. Here is an attempt at code allowing a user to select from an array. But I get the following error: "reference to overloaded function could not be resolved; did you mean to call it?|" #include <iostream> using namespace std; int main() { int selectPlant; string plant[] = {"Etymology and terminology", "Description", "Taxonomy", "Cultivation", "Nutrition", "Uses", "Culture"}; cout << "Please select an item from the Plant table (0-6): "; cin >> selectPlant >> endl; cout << plant[selectPlant] << endl; return 0; }
2 Antworten
+ 7
Remove the endl on the cin line
+ 1
Thank you Jay! I can't imagine why I thought I needed that there.