You have a question in the format “No A is within a class B”. The algorithm for such problem is
bool wrong = false;
while ( /* there is another A */ )
{
if ( /* check if it is NOT within a class */ )
{
wrong=true;
break;
}
}
if (wrong)
{
// here you know that at least one thing was NOT within a class B
}
else
{
// here you know that every item A was within a class B
}
In your case the “class” is “Strings with no space” and to check if there is space you just use this condition.
1
solved Check if each string in file have only one word