1.涉及到年月日,
int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
if((y%4==0&&y%100!=0)||y%400==0) a[2]=29;
2.字符串反转: strrev(s);
reverse(s.begin(),s.end());
3.字符串与数字转换:s->int: s= to_string(n)
字符串转数字:
stringstream stream;
string result=”10000”;
int n=0;
stream<
4.统计文章中的单词数
stringstream ss(str); 5.可以用getchar()来处理不要的输入,比如空格,回车 6.输出手机号后6位:
set
while(ss>>s) Set.insert(s);
cout<printf("%s\n", tel + 5);