Compare two Strings
Lesson 9 of 18 in Coddy's Functions in C++: Building Your Own Functions course.
Challenge
EasyWrite a function to compare two strings.
The function compare_string is a function that takes two strings and returns true if they are equal and false if not.
Example:
- If the input is
"Hello"and“hello”. - The output will be
false.
Try it yourself
#include <iostream>
#include <string>
using namespace std;
bool compareStrings() {
}
All lessons in Functions in C++: Building Your Own Functions
1Introduction
Introduction2Beginner-level function
Repeat a StringReverse a StringMax ValueFill stringCenter TextFormat TextMath Operation3Intermediate-level functions
Compare two StringsSwap CasesCount Alphabetic LetterReplace in ArrayExtracts Integers Generate CharactersDeletes Specific Index