Hi, I am a beginner and I am working on a hw for C++. My code is attached. I am confused about how to restart a loop (see first attached snippet). I am supposed to run two tests on the user string. One to test for quit and one to test to see if the user just hit enter. My professor has provided these functions (see 2nd snippet) and I just call it twice (though not sure if I have called them correctly but that's another question) but with different parameters.
My question: how (after the calls to bool test) do I go back to prompt the user again? Obviously I could just enter the prompt again but that's not a good solution since user could just keep pressing enter.
My first idea was to have a nested while loop testing for the two conditions but I'm pretty confused.
printf("Enter string or type 'quit' to end: \n");
//1st step - test for no text
while ((bool test(user_input,"")==true))
printf("Please enter string:\n");
//2nd step - test for "quit" prompt
if ((bool test(user_input,"quit")==true))
return 0; //exits loop?
bool test (const char* first, const char* second) throw(const char*)
if ( (first == NULL) || (second == NULL) )
throw "NULL ptr to equals";
return( strcmp(first,second) == 0 );