|
![]() | 作者: suphen [suphen]
![]() |
登录 |
#include "iostream" #include "ctime" void main() { std::time_t now = std::time(0); std::cout<<std::asctime(std::gmtime(&now)); } 请问以上代码哪里有错的吗?为什么在VC++环境下编译通不过? 在C-Free3.5下面可以运行呢~~~谢谢了~~新手指教 |
地主 发表时间: 05-07-18 07:38 |
![]() | 回复: 286 [unique] ![]() |
登录 |
在VC下,在放到工程里,并且工程类型是控制台工程。 另外include 后""改为<> |
B1层 发表时间: 05-07-18 09:58 |
![]() | 回复: suphen [suphen] ![]() |
登录 |
用""和<> 只是在开始搜索头文件的起始位置不一样而已啊 跟程序本身应该没什么关系吧 试了还是不行 是不是我的VC++出问题了?? ![]() |
B2层 发表时间: 05-07-18 15:09 |
![]() | 回复: suphen [suphen] ![]() |
登录 |
已经解决了 听说是编译器的问题 VC++比较苛刻 有人指点说改成如下就可以了~~ #include "iostream" #include "ctime" using namespace std; void main() { time_t now = time(0); cout<<asctime(gmtime(&now)); } |
B3层 发表时间: 05-07-18 15:30 |
|
20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon
粤ICP备05087286号