第八课作业
来源:互联网 发布:linux cp 强制覆盖 编辑:程序博客网 时间:2024/06/05 18:20
获取系统时间。本想利用clrscr()函数刷新DOS窗口的,结果c-free中貌似不能用,所以只好用Dos命令“cls”刷新屏幕。
C代码:
- #include <stdio.h>
- #include <time.h>
- #include <conio.h>
- #include <windows.h>
- #ifndef _TM_DEFINED
- /*
- * A structure for storing all kinds of useful information about the
- * current (or another) time.
- */
- struct tm
- {
- int tm_sec; /* Seconds: 0-59 (K&R says 0-61?) */
- int tm_min; /* Minutes: 0-59 */
- int tm_hour; /* Hours since midnight: 0-23 */
- int tm_mday; /* Day of the month: 1-31 */
- int tm_mon; /* Months *since* january: 0-11 */
- int tm_year; /* Years since 1900 */
- int tm_wday; /* Days since Sunday (0-6) */
- int tm_yday; /* Days since Jan. 1: 0-365 */
- int tm_isdst; /* +1 Daylight Savings Time, 0 No DST,
- * -1 don't know */
- };
- #define _TM_DEFINED
- #endif
- int main(int argc, char *argv[])
- {
- while(!feof(stdin))
- {
- time_t sconfieldTimer;
- struct tm*tt;
- time(&sconfieldTimer);
- tt=localtime(&sconfieldTimer);
- printf("%d-%02d-%02d %02d:%02d:%02d/n",
- (*tt).tm_year+1900,tt->tm_mon+1,tt->tm_mday,
- tt->tm_hour,tt->tm_min,tt->tm_sec);
- Sleep(1000);
- system("cls");
- }
- return 0;
- }
C#代码:
- /*
- * Created by SharpDevelop.
- * User: Sconfield
- * Date: 2009/9/3
- * Time: 11:50
- *
- * To change this template use Tools | Options | Coding | Edit Standard Headers.
- */
- using System;
- namespace SconfieldTimer
- {
- class MyTimer
- {
- static void Main()
- {
- Console.WriteLine(DateTime.Now);
- }
- }
- }
- 第八课作业
- BASH第八课作业
- 算法课第八周作业 | Unique Paths
- 第八周--作业要求
- Java作业第八章
- Java作业第八章
- Java作业第八章
- 第八周作业
- 第八周作业
- 第八周作业1
- 第八周作业 1.1
- 第八周作业 1.3
- 第八周作业 2.0
- 第八周作业 3.0
- 第八次上机作业
- 第八次课堂作业
- 第八次上机作业
- 第八周作业-1
- [转]我在装sql 2000 server 时,系统老提示我的计算机有挂起的
- 我又活过来拉
- 初到CSDN
- 我的个人信息介绍
- call by value 与call by reference的区别
- 第八课作业
- 《我是一只IT小小鸟》连载六——掉进读书的兔子洞(2)
- [转]莫生气
- 挺好的一个地方
- jQuery 左右移动
- 外版编程书籍中出现频率较高的词汇——看你是否都认识?
- 字符串转换成二进制,存入mysql
- 预防堕落的三个秘方
- 准备开始学习C++