#include <iostream>
#include <ctime>
using namespace std;
class time
{
protected:
int hr;
public:
void settime()
{
time_t now = time(0);
tm *ltm = localtime(&now);
display(1 + ltm->tm_hour);
}
void display(int a)
{
hr=a;
cout<<hr;
}
};
int main()
{
time t;
t.settime();
return 0;
}
的問題是這樣來顯示時間: 提供一個構造函數,能夠使用從time()函數當前時間 - 在C標準庫頭的時間宣佈。 h - 初始化時間類的一個對象。 我對班級不太瞭解,這是真的嗎。 任何人都可以幫助我嗎?如何使用時間類和函數
請破譯這樣的:'我沒有那麼瞭解有關類,並且是這種方式是TRUE' – Drop