Skip to content

Instantly share code, notes, and snippets.

@AndyNovo
Created March 20, 2017 16:37
Show Gist options
  • Save AndyNovo/005292f12a21750fa9b892edfdb79db6 to your computer and use it in GitHub Desktop.
Save AndyNovo/005292f12a21750fa9b892edfdb79db6 to your computer and use it in GitHub Desktop.
Basic string comparison
#include <iostream>
using namespace std;
int main() {
string text = "text1";
string text2 = "text1";
if (text.compare(text2) == 0){
cout << "They are the same" << endl;
} else {
cout << "They are NOT the same" << endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment