C++ Program to Compare Two Strings Without Using strcmp

In this example, you’ll learn How to compare  two strings in C++ using if condition.


C++ Code:

When you run the program, the output will be:


In the above program, we’ve two strings s1 and s2. We simply use equality operator (==) to compare the two strings, which compares the value Java to C++ and prints Not Equal.


About the author


Leave a Comment