if(command=="insert")
{
int i=0;
while(i>=0)
{
string textToSave[i];
cout << "Enter the string you want saved: " << endl;
cin >>textToSave[i];
ofstream saveFile ("Save.txt");
saveFile << textToSave;
saveFile.close();
i++;
break;
}
}
I want to store the array that i input into .txt file. But i having problem to create the array to store. I also dilemma to choose in between whileloop and forloop, but think that while loop is more suitable because unknow how many time need to insert the words. Please help. Thanks.