标签:ring mode 操作 类型 mod 组合 包含 splay control
1. 关于tuple
#include <iostream> #include <tuple> using namespace std; int main () { tuple<char, int, float> geek; geek = make_tuple(‘a‘, 10,15.5); cout << "The initial values of tuple are:"; cout << get<0>(geek) <<" " << get<1>(geek); cout << " " << get<2>(geek) << endl; get<0>(geek) = ‘b‘; get<2>(geek) = 20.5; cout << "The modefied values of tuple are:"; cout << get<0>(geek) << " " << get<1>(geek); cout << " " << get<2>(geek) << endl; return 0; }
2. 关于enum
#include <bits/stdc++.h> using namespace std; int main() { enum Gender{Male, Female }; Gender gender = Male; switch(gender){ case Male: cout << "Gender is Male"; break; case Female: cout << "Gender is female"; break; default: cout << "Gender is male or female"; } return 0; }
3. 关于map
#include <iostream> #include <string> #include <map> int main () { std::map<std::string,int> mymap = { { "alpha", 0 }, { "beta", 0 }, { "gamma", 0 } }; mymap.at("alpha") = 10; mymap.at("beta") = 20; mymap.at("gamma") = 30; for (auto& x: mymap) { std::cout << x.first << ": " << x.second << ‘\n‘; } return 0; } /*输出: alpha: 10 beta: 20 gamma: 30 */
标签:ring mode 操作 类型 mod 组合 包含 splay control
原文地址:https://www.cnblogs.com/zhaijiayu/p/11707109.html