The CreateList function must: 1. Ask the user for a grocery store name. 2. Ask the user to enter a list of items for this grocery store, until the user enters “done”. 3. Add the items to the vector of strings as they are entered. 4. Display: “Added item to grocery store name list.” after each item is entered, where “item” is the item entered and “grocery store name” is the name entered in Step 1 above.
void CreateList()
{
string store;
string item;
int count = 0;
cout<<"What is the grocery store name"<<endl;
cin>>store;
vector<string> store;
cout<<"Enter a list of items for this grocery store one at a time. When you are done, type done."<<endl;
cin>>item;
store[count] = item; //error saying no conversion?
count++;
cout<<"Added "<<item<<"to "<<store<<"list"<<endl;
bool finished=true;
while (finished = true)
{
cout<<"Enter a list of items for this grocery store one at a time. When you are done, type done."<<endl;
cin>>item;
if (item == "done")
break;
store[count] = item; //error saying no conversion?
count++;
cout<<"Added "<<item<<"to "<<store<<"list"<<endl;
}
}
Had a couple questions on my function, not sure where the no conversion error is coming from, and could this be implemented in a do while loop? Please try to keep your answers as simple as possible, this is my first attempt in C++ while transitioning from python. Thanks for your time.