Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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;    /


Ïà¹ØÎĵµ£º

ÓÅ»¯C´úÂë³£Óõļ¸ÕÐ

ÓÅ»¯C´úÂë³£Óõļ¸ÕÐ
ÔÚÐÔÄÜÓÅ»¯·½ÃæÓÀԶעÒâ80-20Ô­Ôò£¬¼´20%µÄ³ÌÐòÏûºÄÁË80%µÄÔËÐÐʱ¼ä£¬Òò¶øÎÒÃÇÒª¸Ä½øЧÂÊ£¬×îÖ÷ÒªÊÇ¿¼ÂǸĽøÄÇ20%µÄ´úÂë¡£²»ÒªÓÅ»¯³ÌÐòÖпªÏú²»´óµÄÄÇ80%£¬ÕâÊÇÀͶøÎÞ¹¦µÄ¡£
µÚÒ»ÕУºÒԿռ任ʱ¼ä
¼ÆËã»ú³ÌÐòÖÐ×î´óµÄì¶ÜÊÇ¿Õ¼äºÍʱ¼äµÄì¶Ü£¬ÄÇô£¬´ÓÕâ¸ö½Ç¶È³ö·¢ÄæÏò˼άÀ´¿¼ÂdzÌÐòµÄЧÂÊÎÊÌ⣬ÎÒ ......

C ±à³Ì×î¼Ñʵ¼ù


¼ò½é
±¾ÎÄÊÇΪÁËÂú×㿪·¢ÈËÔ±µÄÐèÒª¶øдµÄ¡£ÎÒÃÇ×ܽáÁËÒ»Ì×Ö¸ÄÏ£¬ÎÞÂÛ×÷Ϊ¿ª·¢ÈËÔ±»¹ÊǹËÎÊ£¬ÕâЩָÄ϶àÄêÀ´Ò»Ö±¶¼ºÜºÃµØÖ¸µ¼×ÅÎÒÃÇ£¬ÎÒÃÇ°ÑËüÃÇ×÷Ϊ½¨ÒéÌṩ¸øÄú£¬Ï£Íû¶ÔÄúµÄ¹¤×÷ÓÐËù°ïÖú¡£ÄúÒ²Ðí²»ÔÞͬÆäÖеÄijЩָÄÏ£¬µ«ÎÒÃÇÏ£ÍûÄú»áϲ»¶ÆäÖеÄһЩ²¢ÔÚÄúµÄ±à³Ì»òÒÆÖ²ÏîÄ¿ÖÐʹÓÃËüÃÇ¡£
·ç¸ñÓëÖ¸ÄÏ
ʹÓÃÒ»ÖÖʹ´úÂë¾ß ......

CÖÐÎļþ°üº¬µÄһЩÈÏʶ

   ½ñÌ죬ÔÚÉè¼ÆC´úÂëµÄʱºò£¬Ïëµ½ÁËÒ»µã£¬ÏëÈÃB°üº¬A£¬²¢×ÔÓÉʹÓÃAµÄÍ·Îļþ£¬µ«ÊÇÈ´²»ÏëÈðüº¬BµÄCʹÓÃA£¬ÈÃAûÓÐȨÏÞÖ±½ÓʹÓÃʹÓÃC……ÈçÏÂͼ£º
  
   ²»ÖªµÀÓ¦¸ÃÔõô°ì¡£µ±Ê±ÐÄÏ룬Èç¹ûÊÇC++£¬Ê¹Óü̳У¬ºÜÁé»î¾ÍÄܸ㶨ÕâЩÊÂ
   ¸úͬÊÂÉÌÁ¿ÁËһϣ¬¶Ô·½¸ø³öÁË ......

¹ØÓÚCµÄ0x8±¾¡°¾­Ê顱£ÛǶÈëʽ±Ø¶Á£Ý

ÔÚµ±½ñǶÈëʽ“ÎäÁÖ”ÖУ¬Á÷´«×ż¸±¾ÈËÈ˶¼Ïë͵ѧ¼¸ÕеÄCÓïÑÔµÄÎ书Ãؼ®¡£ÕâЩÃؼ®¶¼ÊÇ¿õÊÀÎäѧÆæ²ÅºÄ¾¡±ÏÉú¾«Á¦ËùÖø£¬²¿·ÖÃؼ®Á÷¾­ÊýÊ®ÔØÈÔ¾­¾Ã²»Ë¥£¬ÈÃËüµÄÎÞÊýʵϰÕßÊÜÒæ·Ëdz¡£¡¡¡¡½ñÌ죬³ÐÃÉÎäÁÖ´ó»áËùÍÏ£¬ÔÚÕ⹫²¼Õ⼸±¾¹ØÓÚCµÄ“¾­Ê锣¬Èøü¶àÈËʵϰ֮£¬Á·¾ÍÒ»Éí¾øÊÀµÄǶÈëʽCÓïÑԺù¦·ò¡£Î书à ......

ǶÈëʽC±ÊÊÔ£¡

1. ÓÃÔ¤´¦ÀíÖ¸Áî#define ÉùÃ÷Ò»¸ö³£Êý£¬ÓÃÒÔ±íÃ÷1ÄêÖÐÓжàÉÙÃ루ºöÂÔÈòÄêÎÊÌ⣩
#define SECONDS_PER_YEAR (60 * 60 * 24 * 365)UL
ÎÒÔÚÕâÏë¿´µ½¼¸¼þÊÂÇ飺
1). #define Óï·¨µÄ»ù±¾ÖªÊ¶£¨ÀýÈ磺²»ÄÜÒԷֺŽáÊø£¬À¨ºÅµÄʹÓ㬵ȵȣ©
2). ¶®µÃÔ¤´¦ÀíÆ÷½«ÎªÄã¼ÆËã³£Êý±í´ïʽµÄÖµ£¬Òò´Ë£¬Ö±½Óд³öÄãÊÇÈçºÎ¼ÆËãÒ»ÄêÖÐÓж ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ