一、观看视频 
【01】字符串类(2)
【02】成绩排序
二、研读学生讲义
【学生讲义】【01】字符串类(2) 【学生讲义】【02】成绩排序 
三、练习题(不清楚回头查看有关视频或讲义)
【01】说出下面程序的输出,然后运行验证:
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
#include<string>#include<iostream>using namespace std;int main(){  string s = "Hello, Xiaozhi!!!";  string s1 = s.substr(2);  string s2 = s.substr(2, 3);  cout << s1 << endl << s2 << endl;  return 0;}
【02】说出下面程序的输出,然后运行验证:
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
#include<string>#include<iostream>using namespace std;int main(){  string s = "Hello, Xiaozhi!!!";  string s1 = s.erase(6);  string s2 = s.erase(1, 2);  cout << s << endl << s1 << endl << s2 << endl;  return 0;}
【03】说出下面程序的输出,然后运行验证:
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
#include<string>#include<iostream>using namespace std;int main(){  string s = ",";  s.insert(0,"heo");  cout << s << endl;  s.insert(4, "world", 2);  cout << s << endl;  s.insert(2, 2, '1');  cout << s << endl;  s.insert(s.end(), 'r');  cout << s << endl;  s += "ld!";  cout << s << endl;  return 0;}
【04】说出下面程序的输出,然后运行验证:
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
#include<string>#include<iostream>using namespace std;int main(){  string s = "Hello, world!";  s.replace(7, 6, "xz");  cout << s << endl;  s.replace(7, 3, "xiaozhi", 6);  cout << s << endl;  s.replace(7, 6, 3, 'z');  cout << s << endl;  return 0;}
【05】说出下面程序的输出,然后运行验证:
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
#include<string>#include<iostream>using namespace std;int main(){  string s = "Hello, world!";  string filter = ",!";  cout << s.find('l', 1) << endl;  cout << s.find("lo", 7) << endl << string::npos << endl;  cout << s.rfind("lo", 7) << endl;  cout << s.find_first_of(filter, 2) << endl;  cout << s.find_last_of(filter) << endl;  cout << s.find_first_not_of(filter) << endl;  cout << s.find_last_not_of(filter) << endl;  return 0;}
【06】如果在下面的程序中输入下面10个单词HellohelloWorldworldC++PythonScratchXuesiyingxuesiying5xstar.com,输出的是什么?
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
· 
#include<string>#include<iostream>#include<algorithm>using namespace std;int main(){  string s[10];  for (int i = 0; i < 10; i++)  {    getline(cin, s[i]);  }  sort(s, s + 10);  for (int i = 0; i <= 10; i++)  {    cout << s[i] << endl;  }  return 0;}
【07】编程题(成绩排序) 【08】OpenJudge练习
【08】OpenJudge练习
【OpenJudge-1.7-30】字符环
【OpenJudge-1.7-31】字符串p型编码
【OpenJudge-1.7-32】行程长度编码