C/C++ʱ¼äº¯Êý
clock()·µ»Øclock_tÀàÐÍ£»
ÔÚtime.hÍ·ÎļþÖУ¬¶¨ÒåÁË typedef long clock_t
clock()ÊÇÓÃÀ´¼ÆËãÁ½¸öʱ¼äµãÖ®¼äµÄʱ¼ä¼ä¸ô¡£ÈçϳÌÐò£º
#include <stdio.h>
int main()
{
int i = 0;
clock_t start_time, end_time;
start_time = clock(); //¿ªÊ¼¼Æʱ, start_time = 0
while(i < 10000000)
i++;
end_time = clock();
printf("from 0 to 10000000 empty loops: %d (ms)\n", end_time - start_time);
return 0;
}
ps:°Ñint i = 0;·ÅÔÚclock_t start_time, end_time;Ö®ºó¾Í»á³öÏÖ´íÎó£¨ÔÚvc 6.0±àÒë»·¾³Ï£©
time_t
time()ÓÃÀ´µÃµ½ÏµÍ³µ±Ç°µÄʱ¼ä£¬ÊÇ´Ó1970Äê1ÔÂ1ºÅ0ʱ0·Ö0Ã뿪ʼ¼ÆËãµÄÃëÊý
ÔÚtime.hÍ·ÎļþÖУ¬¶¨ÒåÁËtypedef long time_t
time_t¿ÉÒÔͨ¹ýgmtime(const time_t *timeptr), localtime(const time_t* timeptr)ת³Éstruct tm*¸ñʽ
tmµÄ¶¨ÒåÈçÏ£º
struct tm {
int tm_sec; /* Ãë – È¡ÖµÇø¼äΪ[0,59] */
int tm_min; /* ·Ö - È¡ÖµÇø¼äΪ[0,59] */
int tm_hour; /* ʱ - È¡ÖµÇø¼äΪ[0,23] */
int tm_mday; /* Ò»¸öÔÂÖеÄÈÕÆÚ - È¡ÖµÇø¼äΪ[1,31] */
int tm_mon; /* Ô·ݣ¨´ÓÒ»Ô¿ªÊ¼£¬0´ú±íÒ»Ô£© - È¡ÖµÇø¼äΪ[0,11] */
int tm_year; /* Äê·Ý£¬ÆäÖµµÈÓÚʵ¼ÊÄê·Ý¼õÈ¥1900 */
int tm_wday; /* ÐÇÆÚ – È¡ÖµÇø¼äΪ[0,6]£¬ÆäÖÐ0´ú±íÐÇÆÚÌ죬1´ú±íÐÇÆÚÒ»£¬ÒÔ´ËÀàÍÆ */
int tm_yday; /* ´ÓÿÄêµÄ1ÔÂ1ÈÕ¿ªÊ¼µÄÌìÊý – È¡ÖµÇø¼äΪ[0,365]£¬ÆäÖÐ0´ú±í1ÔÂ1ÈÕ£¬1´ú±í1ÔÂ2ÈÕ£¬ÒÔ´ËÀàÍÆ */
int tm_isdst; /
Ïà¹ØÎĵµ£º
1. CµÄʵÏÖ
//stack.h
#ifndef STACK_H
#define STACK_H
#define STACK_CAPACITY 20//maximum size of stack
typedef int stackEle;
typedef struct
{
stackEle myArray[ STACK_CAPACITY ];
int myTop;
}stack;
//construct(initialize) an empty stack
stack *stack_init(void);
//return 1 if stack is em ......
Ç°¼¸Ì칫˾ÈÃÎÒ×öCÓïÑÔºÍMySQLÊý¾Ý¿âµÄ½»»¥²Ù×÷£¬·ÑÁ˾ÅÅ£¶þ»¢Ö®Á¦Ö®ºó×ÜËã×ö³öÀ´ÁË£¬½ñÌìÌصذÑÔ´´úÂëÌù³öÀ´¹©´ó¼Òѧϰ£»ÈçÓÐÈËÏëÒª´ò°üÏîÄ¿¿ÉÒÔ¼ÓÎÒQQ260990509,×¢Ã÷¼¼Êõ½»Á÷£¬¼´¿É»ñµÃ´ò°üÖ®ºóµÄÏîÄ¿£¡
#if defined(_WIN32) || defined(_WIN64) //ΪÁËÖ§³Öwindowsƽ̨ÉϵıàÒë
#include <windows.h>
#end ......
¡¡¡¡Ëùν“Îļþ”ÊÇÖ¸Ò»×éÏà¹ØÊý¾ÝµÄÓÐÐò¼¯ºÏ¡£ Õâ¸öÊý¾Ý¼¯ÓÐÒ»¸öÃû³Æ£¬½Ð×öÎļþÃû¡£ ʵ¼ÊÉÏÔÚÇ°ÃæµÄ¸÷ÕÂÖÐÎÒÃÇÒѾ¶à´ÎʹÓÃÁËÎļþ£¬ÀýÈçÔ´³ÌÐòÎļþ¡¢Ä¿±êÎļþ¡¢¿ÉÖ´ÐÐÎļþ¡¢¿âÎļþ (Í·Îļþ)µÈ¡£Îļþͨ³£ÊÇפÁôÔÚÍⲿ½éÖÊ(Èç´ÅÅ̵È)Éϵģ¬ ÔÚʹÓÃʱ²Åµ÷ÈëÄÚ´æÖÐÀ´¡£´Ó²»Í¬µÄ½Ç¶È¿É¶ÔÎļþ×÷²»Í¬µÄ·ÖÀà¡£´ÓÓû ......