我有以下代码片段:
time_t data1 = time(0)+86400;
struct tm * data_emprestimo = localtime( & data1 );
cout << "Hoje: " << data_emprestimo->tm_mday << '/' << (data_emprestimo->tm_mon + 1) << '/' << (data_emprestimo->tm_year + 1900) << endl;
它运作良好。
但我想知道我应该在函数中返回哪种类型来获取 cout 回显并放入变量:struct tm?只是tm?大批?细绳?
我试过这样的事情:
struct tm retornaData(int segundosAdd);
...
...
struct tm retornaData(int segundosAdd){
return data_emprestimo;
}
但它没有用。
我已经用谷歌搜索了很多!