I'm trying to allow someone to input variables into a shopping list so you can then output them after you are done inputting by inputting * The program is giving me a segmentation fault for some reason. Please help! :(
shoppinglist.push_back("a");
cout << "Enter your shopping list. Enter * to indicate you are done." << endl;
while(newItem != "*"){
cin >> newItem;
shoppinglist[i] = newItem;
i++;
}
Should be :
1 2 3 4 5 6 7 8 9
i = 0;
cout << "Enter your shopping list. Enter * to indicate you are done." << endl;
while(newItem != "*"){
cin >> newItem;
shoppinglist.push_back("a");
shoppinglist[i] = newItem;
i++;
}