# Include <iostream> # include <string> using namespace STD; int main () {string S1 = "hello"; string S2 = "world"; string S3 = S1 + S2; // Add two strings, which are allowed strings S4 = "hello" + "word"; // The cout is not allowed <S3 <Endl; // correct cout <S4 <Endl; // The cout is incorrect <"hello" + "world" <Endl; // The cout is incorrect <S1 + "world" <Endl; // correct} // a sentence, connected to the string literal value, at least one is of the string type. The string: size_type type is used to receive the size () value returned by the string. The string subscript starts from 0 to string: size ()-1 # include <iostream> using namespace STD; int main () {string S = "hello"; for (string: size_type I = 0; I <S. size (); I ++) {cout <s [I] ;}cout <Endl; return 0 ;}
String in C ++ can be usedC Language(Cctype header)TextProvided functions.