2 like 0 dislike

在 time.h 中有一個表示時間的結構 tm,裡面有三個成員分別代表所取得時間的時(tm_hour)、分(tm_min)、秒(tm_sec)。它的使用方式:先宣告 time_t curtime;  struct tm *pTime; 這個變數,然後利用 time(&curtime) 先取得1970 年元旦至今的總秒數,再透過 pTime = localtime(&curtime) 就可以轉換成目前電腦的日期與時間。之後就可以利用 pTime 去存取時、分、秒的內容,請依照上面的說明,設計一個電子時鐘,顯示目前的時、分、秒。NOTE:system("cls") 可用來清楚螢幕的顯示。

 

參考書籍:旗標無痛學習教本

[Normal] Essay (Open question) - asked in Introduction to Computer Programming I (C) by (20.9k points)
Available when: Unlimited - Due to: Unlimited
| 2 views
Get it on Google Play Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:108.162.221.219
©2016-2019

Related questions

2 like 0 dislike
0 answers
[Normal] Essay (Open question) - asked Feb 11, 2017 in Introduction to Computer Programming I (C) by The Contributor (20.9k points)
Available when: Unlimited - Due to: Unlimited
| 5 views
1 like 0 dislike
0 answers
[Normal] Essay (Open question) - asked Feb 11, 2017 in Introduction to Computer Programming I (C) by The Contributor (20.9k points)
Available when: Unlimited - Due to: Unlimited
| 4 views
2 like 0 dislike
0 answers
[Normal] Essay (Open question) - asked Feb 11, 2017 in Introduction to Computer Programming I (C) by The Contributor (20.9k points)
Available when: Unlimited - Due to: Unlimited
| 2 views
2 like 0 dislike
0 answers
[Normal] Essay (Open question) - asked Feb 11, 2017 in Introduction to Computer Programming I (C) by The Contributor (20.9k points)
Available when: Unlimited - Due to: Unlimited
| 2 views
3 like 0 dislike
0 answers
[Normal] Essay (Open question) - asked Feb 19, 2017 in Introduction to Computer Programming I (C) by The Contributor (20.9k points)
Available when: Unlimited - Due to: Unlimited
| 3 views
8,045 questions
60,931 answers
33,050 comments
1,122 users