- 博客(3)
- 收藏
- 关注
原创 C++格式化输出
C++用"<<"格式化输出int x = 3, y = 4;cout<< "("<<x<<","<<y<<")" << endl;输出结果:(3,4)
2020-04-27 15:27:25
165
原创 C++获取随机数
C++获取随机数#include <iostream>#include <cstdlib>#include <ctime>srand(time(0)); // 设置随机数种子,和当前时间相关 // 或者 srand(NULL);auto a = rand(); // 获取一个随机数for (int i = 0; i < 10; ...
2020-04-27 14:52:33
347
原创 C++获取时间
C++获取时间#include <ctime>time_t t;time(&t);auto t1 = ctime(&t);// t1即当前时间// 输出样例:Mon Apr 27 12:57:48 2020
2020-04-27 12:59:24
140
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人