C++中srand(unsined int) time(NULL) 前置++后置++ tolower

来源:互联网 发布:数据挖掘行业应用 编辑:程序博客网 时间:2024/06/10 21:48
 srand()函数是用来重置随机数的种子。参数为一个unsigned inttime()取当前时间。整个语句就是将随机数的种子设为当前时间。经常会在随机数使用前用到,可以保证每次生成的随机数不一样。

 

 

1.看tolower声明: template<Class CharType> CharType tolower( CharType _Ch, const locale& _Loc ) 具体到C库中: int __cdecl tolower(_In_ int _C); 看到返回值没? 

 

 2.前置++和后置++区别 因为在内部的实现上,后置++是根据前置++来实现的,后置++在重载的时候构建了一个临时变量,如: T operator ++ (int) { T tmp; //这里应该T tmp(*this);写错了++(*this); return tmp; } 你觉得用什么更快呢?

原创粉丝点击