我得到以下错误讯息...如下2013年12月8日在C++
错误1 错误C4996如何输出日期:“本地时间”:此函数或变量可能是不安全的。考虑使用localtime_s来代替。要禁用折旧,请使用 _CRT_SECURE_NO_WARNINGS
任何帮助,将不胜感激。
const char EOL('\n');
int main() //draw Xmas tree
{
time_t now = time(0);
tm *ltm = localtime(&now);
cout << "Damon Reynolds Tut 1V"<< ltm->tm_mday << " "
<< 1 + ltm->tm_mon << " " << 1900 + ltm->tm_year;
getValidHeigth(); //call procedure
cout << EOL; //then output a new line
drawBranches(); //call procedure
drawTrunk(); //call procedure
cout << EOL; //then output a new line
system("PAUSE"); //hold the screen until a key is pressed
return(0);
}
你应该输出''\ n''为换行。 – chris
@chris或'std :: endl' – godel9
@ godel9,只有当你需要刷新它时,然后你最好明确地做一个换行符和一个'std :: flush'。 – chris