Mega Code Archive

 
Categories / C++ Tutorial / String
 

Is it a string

#include <iostream> #include <string> using namespace std; int main() {     string word1 = "Game";     string word2("Over");     string word3(3, '!');     string phrase = word1 + " " + word2 + word3;     cout << phrase << endl;     if (phrase.find("eggplant") == string::npos)         cout << "'eggplant' is not in the phrase.\n\n";     return 0; }