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)
ID: 21899 - Available when: Unlimited - Due to: Unlimited
| 91 views
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:35.172.217.174
©2016-2021

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)
ID: 21900 - Available when: Unlimited - Due to: Unlimited
| 98 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)
ID: 21898 - Available when: Unlimited - Due to: Unlimited
| 113 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)
ID: 21897 - Available when: Unlimited - Due to: Unlimited
| 100 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)
ID: 21896 - Available when: Unlimited - Due to: Unlimited
| 92 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)
ID: 21943 - Available when: Unlimited - Due to: Unlimited
| 98 views
12,268 questions
164,383 answers
162,601 comments
4,640 users