牛客网刷题总结

//输入一整行string
string s;
while(getline(cin, s))
//分开输入
while(cin >> s1 >> s2)

//单引号下表示字符
‘ ’   ‘a’

//字符串长度
str.size();

//string 中寻找和截取
size_t found = str.find_first_of(';', start_idx=0);
found == string::npos;
string s1 = str.substr(start_idx)
string s2 = str.substr(satrt_idx, n);
//取后n位
string s3 = str.substr(str.size()-n, n);


//大小写之间差32
‘A'+32='a'
//idx与字符之间转换
char c;
int idx1 = c - '0';
int idx2 = c - 'a';

//std::ceil   floor头文件
#incloude <cmath>

//四舍五入 std::round
//int (in+0.5);

//容器迭代循环中末尾设置
it!=m.end();

//字符输入
char c = getchar();
while(cin >> c);


//翻转algorithm
std::reverse(a.begin(), a.end());

//寻找
std::find(a.begin(), a.end(), val)

猜你喜欢

转载自www.cnblogs.com/narjaja/p/10987201.html