| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3594 人关注过本帖
标题:关于srand(time(0));的错误
取消只看楼主 加入收藏
cstdio
Rank: 5Rank: 5
来 自:上海市静安区
等 级:贵宾
威 望:15
帖 子:97
专家分:44
注 册:2018-5-30
结帖率:87.5%
收藏
已结贴  问题点数:20 回复次数:4 
关于srand(time(0));的错误
srand(time(0))如果包含ctime就会在using ::clock出错
搜索更多相关主题的帖子: srand time 错误 using 出错 
2018-07-17 13:40
cstdio
Rank: 5Rank: 5
来 自:上海市静安区
等 级:贵宾
威 望:15
帖 子:97
专家分:44
注 册:2018-5-30
收藏
得分:0 
60    11    C:\Program Files (x86)\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\ctime    [Error] '::tm' has not been declared
62    11    C:\Program Files (x86)\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\ctime    [Error] '::clock' has not been declared
63    11    C:\Program Files (x86)\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\ctime    [Error] '::difftime' has not been declared
64    11    C:\Program Files (x86)\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\ctime    [Error] '::mktime' has not been declared
65    11    C:\Program Files (x86)\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\ctime    [Error] '::time' has not been declared
66    11    C:\Program Files (x86)\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\ctime    [Error] '::asctime' has not been declared
67    11    C:\Program Files (x86)\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\ctime    [Error] '::ctime' has not been declared
68    11    C:\Program Files (x86)\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\ctime    [Error] '::gmtime' has not been declared
69    11    C:\Program Files (x86)\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\ctime    [Error] '::localtime' has not been declared
70    11    C:\Program Files (x86)\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\ctime    [Error] '::strftime' has not been declared
6    39    C:\1.cpp    [Error] 'nullptr' was not declared in this scope
6    46    C:\1.cpp    [Error] 'time' was not declared in this scope

import random
i=random.randint(100,100000)
print i
2018-07-18 10:17
cstdio
Rank: 5Rank: 5
来 自:上海市静安区
等 级:贵宾
威 望:15
帖 子:97
专家分:44
注 册:2018-5-30
收藏
得分:0 
dev_c++ 32bit release

import random
i=random.randint(100,100000)
print i
2018-07-18 10:17
cstdio
Rank: 5Rank: 5
来 自:上海市静安区
等 级:贵宾
威 望:15
帖 子:97
专家分:44
注 册:2018-5-30
收藏
得分:0 
重装好多遍都没有用
包含ctime的文件都会编译错误

import random
i=random.randint(100,100000)
print i
2018-07-18 10:18
cstdio
Rank: 5Rank: 5
来 自:上海市静安区
等 级:贵宾
威 望:15
帖 子:97
专家分:44
注 册:2018-5-30
收藏
得分:0 
我用的就是2楼的代码
没有time.h文件啊

import random
i=random.randint(100,100000)
print i
2018-07-18 13:42
快速回复:关于srand(time(0));的错误
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012621 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved