C++ char array and string

Initialization: char ch[20]="charrr";
            string str="stringgg";
Input: cin>>ch;

          cin>>str;
           Enter a word, and leave the space or subsequent word input in the queue, which affects the next input (cin.getline() will read the space automatically ends, and cin will treat the next word as input, which is not allowed to enter)
        cin.getline(ch,20); read a line of input into an array
        getline(cin,str); read a line of input into a string object
String length: strlen(ch);

                    str.size();
Copy: strcpy(ch1,ch2);

           str1=str2;
Splicing: strcat(ch,"jinjiezhe");

          str1+=str2;  str3=ste1+str2;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324763270&siteId=291194637