随笔分类 -  C++

摘要:#include #include #define random(x) (rand()%x) using namespace std; int main() { // 生成随机种子 srand((int)time(0)); // rand()产生 0~INT_MAX 区间内的随机数 // 利用余数来得到 0~任意范围内的随机数 int x =... 阅读全文
posted @ 2016-12-26 11:05 `Laimic 阅读(100) 评论(0) 推荐(0)
摘要:利用 fin, fout 来进行文件读写 阅读全文
posted @ 2016-12-26 11:03 `Laimic 阅读(127) 评论(0) 推荐(0)
摘要:重载运算符 struct myStruct{ int count; bool operator < (const myStruct &a){ return count < a.count; } }; 阅读全文
posted @ 2016-02-15 10:29 `Laimic 阅读(118) 评论(0) 推荐(0)
摘要:初始化 string a, b = ""; //空字符串 string a(b); //复制B字符串 string a("string") //赋值字符串 string a(n, 'a') //赋值n个'a' 阅读全文
posted @ 2016-02-14 14:56 `Laimic 阅读(114) 评论(0) 推荐(0)