Input: [1-st string]Dog
[2-nd string]I love dog
[3-rd string]Dog love me
[4-th string]Love
Output: [1-st string]Dog
[2-nd string]Love
How can i do such thing in c++ ?>Without using vector.Thx:)
Asked
Active
Viewed 166 times
-5

Olafus
- 7
- 3
-
What is the description of your problem? – pcghose Nov 14 '19 at 06:28
1 Answers
0
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.

v010dya
- 5,296
- 7
- 28
- 48