I am new to C++ and was trying a lot to take strings from the user and add those inside an empty array. I read my book but did not get proper explanation. I understand my code is not right but what I am trying to do is, asking a user to give a string, and until the user types "Quit", the program should take the strings and add that to my empty array named listt. After that I declared variable named len and tried to get the length of the array that I just made. However I am getting several errors and looked for resources to fix my problems. Still I could not do it. It will be genuinely helpful if someone can please help me to solve this problem. Thank you very much. My code is:
#include <iostream>
using namespace std;
int main()
{
string listt[];
string word;
cout<< "Enter word: ";
while (word != "Quit" ){
cin >> word;
listt.push_back(word);
}
cout << listt;
int len ;
len = listt.size();
cout << len;
for (int i=0; i < len; i++){
cout << i;
cout << endl;
}
return 0;
}