I have an area within my program that the user will need to input a list of words and once done use ctrl-z to end the list. I then want to take the list of words that the user enters and have a function do something to that list of words. I am not sure if it's my input or my function that I am having trouble with. It's not allowing me to use the whole list the user entered...just the last word that was entered. I think I need more to my while loop but I'm just not sure what else to put here. Any ideas?
1 2 3 4 5 6 7 8 9 10 11 12 13
cout<<"Word? (or CTRL Z to end)";
while (cin>>word)
{
cout<<"Word? ";
}
//function call is here in my code
In a Unix-like terminal Ctrl+Z stops a program while Ctrl+D sends an EOF. I believe Gaminic solution to be more universally effective but change the word END to EOF which avoids the chance of the user needing the word END and being put in an odd position.