Difference between revisions of "CPP/Strings/Compare"
From ProgrammingExamples
< CPP
Daviddoria (Talk | contribs) (Created page with '==CompareStrings.cpp== <source lang="cpp"> #include <iostream> #include <string> using namespace std; int main(int argc, char *argv[]) { string Hello = "Hello"; string Go…') |
Daviddoria (Talk | contribs) m (moved CPP/CompareStrings to CPP/Strings/Compare) |
(No difference)
|
Latest revision as of 07:52, 23 June 2010
CompareStrings.cpp
#include <iostream> #include <string> using namespace std; int main(int argc, char *argv[]) { string Hello = "Hello"; string Goodbye = "Goodbye"; cout << Hello.compare(Goodbye) << " (should be != 0)" << endl; cout << Hello.compare(Hello) << " (should be == 0)" << endl; cout << Hello.compare("Hello") << " (should be == 0)" << endl; return 0; }