I have a question(s) about the format of a sentinel value loop. For my assignment, I must create a program that asks a user to input a phrase and then at the end the program will display the combinations of all the phrases.
1 2 3 4 5 6 7 8 9
cout << "Please input your phrase" << endl;
cin >> phrase;
while ( phrase != finish ) // sentinel value of "finish"
{
cout << "The previous phrase was:" << phrase << endl;
cout << "Please input your phrase" << endl;
cin >> phrase;
}
cout << The phrase is: << phrase << endl;
I am wondering how I can store all these values as a single variable? Thanks.