I have the program asking the user how many restaurants they want to choose from. They then enter how many restaurants they picked. I then want it to read the choices back out, but for some reason my second for loop just keeps looping and won't stop. I cannot figure out why. I also tried using a different integer (int j) for the second loop, and that changed nothing.
#include <iostream>
#include <string>
#include <cstdlib>
usingnamespace std;
int main()
{
int num_places;
string places[100];
cout << "How many places do you want to eat at today?";
cin >> num_places;
for (int i=1; i <= num_places; ++i)
{
cout << "What is your number " << i << " place you want to eat at: ";
cin >> places[i];
cout << endl;
}
for (int i=1; i <= num_places; ++i)
{
if (i=1)
cout << "Your choices are: " << places[i];
cout << " " << places[i];
}
return 0;
}