When I enter start then the program outputs the else function even though I fulfilled the criteria, I have tried with && as well and it still didn\'t work. Any answe
The || works only in logical boolean expression.
From the standard (emphasis is mine):
5.15 Logical OR operator [expr.log.or]
The
||operator groups left-to-right. The operands are both contextually converted tobool(Clause 4). It returnstrueif either of its operands istrue, andfalseotherwise.
So in input.find("end" || "End"), it tries to convert "end" and "End" to bool. And the operator || will return a bool also.
Here to solve your problem you need to replace:
if (input.find("end" || "End") != std::string::npos)
by
if ( input.find("End") != std::string::npos ||
input.find("End") != std::string::npos )
And do the same in the second find.