C++ examples for Data Type:string
Create and initialize string value, append two string values together
#include <string> #include <iostream> using namespace std; int main() {/*from ww w .j av a 2s .c o m*/ string s1, s2; string s3 = "Hello, World. this is a test"; // Initialized string s4("I am"); s2 = "Today"; s1 = s3 + " " + s4; s1 += " 8 "; cout << s1 + s2 + "!" << endl; }