The basic knowledge of recent learning algorithms and input and output, first of all I wrote a code reference and learned a lot of resources
The references are given later, and they are written in more detail, and the support of regular expressions is indeed a big highlight.
#include <iostream>#include<string>#include<cstdio>using namespacestd;//characters and other types of conversion function LearningintMain () {//Print to a stringcout <<"tips for printing to a string \ n"; Chars[ -]; sprintf (s),"%d",123);//Convert integer to charactercout << S <<Endl; sprintf (s),"%5d%5d",123,46578);//format control, left-justifiedcout << S <<Endl; sprintf (s),"%-5d%-5d",123,46578);//format control, right-alignedcout << S <<Endl; sprintf (s),"%8x",14567);//16 binary Printingcout << S <<Endl; cout<<"reads data from a string that matches the specified format \ n"; //convert strings to numbers intN; Chars0[ -] ="0123456"; SSCANF (S0,"%d", &n);//leading 0 will be filteredcout << N <<Endl; SSCANF (S0,"%2d", &n);//Bitwise width, 01-->1cout << N <<Endl; Chars1[ $]; SSCANF ("123456","%s", S1); cout<< s1<<Endl; SSCANF ("123456ABCD","%[^b]", S1);//takes the specified charactercout << S1 <<Endl; SSCANF ("123abEFac","%[^a-z]", S1);//take to uppercase characterscout << S1 <<Endl; stringS3 =S1; cout<<S3; return 0;}
Resources:
Conversion of String, char *, char[] in C + +
Https://www.cnblogs.com/Pillar/p/4206452.html
Example of sscanf function usage
Http://www.cnblogs.com/zhuangwei/p/5296219.html
C-Language SSCANF usage parsing and regular expression support