|
|
楼主 |
发表于 2010-8-12 09:26:05
|
显示全部楼层
#include <STDIO.H>
2 _+ h1 n) V3 q# |. z#include <BIOS.H>
& S$ I5 p$ s* D2 R5 g5 v7 L#include <TIME.H>! t) n" t4 x D) Z8 Y$ s9 f/ Z
#include <CONIO.H>
9 Z1 p" D( x Z7 Y- Fint main(void)
: E' k$ c6 h v) |9 }- l/ M# N{ long int bios_time;
4 c6 J' N4 y7 X; f6 |, I clrscr();
+ X$ d/ V. K, }2 [* l cprintf("The number of clock ticks since midnight is:\r\n");
6 G" t; E# }9 } e6 M# K/ \; T% c cprintf("The number of seconds since midnight is:\r\n");3 `6 u; I$ ]$ a
cprintf("The number of minutes since midnight is:\r\n");7 T* f$ g9 r; a
cprintf("The number of hours since midnight is:\r\n");
6 d8 V [6 n% T/ }9 z7 i( f1 d textcolor(9);
9 N0 K0 Z- G% l! x* ?$ `3 H cprintf("\r\nPress any key to quit:");& r" k1 p& T& t+ D) r4 k# {# b
textcolor(12);, N+ I. a4 e s8 m% p6 ~9 z- G
while(!kbhit()) {
+ V4 ~: T" B6 W% I: q bios_time = biostime(0, 0L);/ X9 K9 w+ X" N) P; s. r
gotoxy(50, 1);" n9 t9 V$ P: }% g" q
cprintf("%lu", bios_time);
: g+ d: o0 h7 h, S% z0 C( T gotoxy(50, 2);
4 s$ q& ]# p* W \0 H cprintf("%.4f", bios_time / CLK_TCK);
: j2 a! i4 \% H. b5 g gotoxy(50, 3);0 A$ |& G: {6 I! S! c% |9 [
cprintf("%.4f", bios_time / CLK_TCK / 60);3 v' n S( x4 w9 O
gotoxy(50, 4); o" N; Z) A/ C# v
cprintf("%.4f", bios_time / CLK_TCK / 3600);# Z) o7 a, H9 Z& F
}
0 Z, K7 M8 l- z/ { return 0;
- q8 b( |* i% W. c0 p}
; p7 N" T0 y6 N1 W7 {3 ~5 R, }# @& V. s6 N; q3 Q" n7 S3 H
" K, e" a+ _/ A x" S [4 o
& R, ~! U9 g, Q! I" @% MTC运行一下,然后把biostime(0,0L)括号里面的数值改掉运行一下,再改回原值,你就知道我问的是什么了,初学,不知道怎么问,见谅。 |
|