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

C/C++ʱ¼äº¯ÊýµÄʹÓÃ

Ò»¡¢»ñÈ¡ÈÕÀúʱ¼ä
time_tÊǶ¨ÒåÔÚtime.hÖеÄÒ»¸öÀàÐÍ£¬±íʾһ¸öÈÕÀúʱ¼ä£¬Ò²¾ÍÊÇ´Ó1970Äê1ÔÂ1ÈÕ0ʱ0·Ö0Ãëµ½´ËʱµÄÃëÊý£¬Ô­ÐÍÊÇ£º
 typedef long time_t;        /* time value */
¿ÉÒÔ¿´³ötime_tÆäʵÊÇÒ»¸ö³¤ÕûÐÍ£¬ÓÉÓÚ³¤ÕûÐÍÄܱíʾµÄÊýÖµÓÐÏÞ£¬Òò´ËËüÄܱíʾµÄ×î³Ùʱ¼äÊÇ2038Äê1ÔÂ18ÈÕ19ʱ14·Ö07Ãë¡£
º¯Êýtime¿ÉÒÔ»ñÈ¡µ±Ç°ÈÕÀúʱ¼äʱ¼ä£¬timeµÄ¶¨Ò壺
 time_t time(time_t *)
 
#include <iostream>
#include <time.h>
using namespace std;
int main(void)
{
time_t nowtime;
nowtime = time(NULL); //»ñÈ¡µ±Ç°Ê±¼ä
cout << nowtime << endl;

return 0;
}
 
Êä³ö½á¹û:1268575163
¶þ¡¢»ñÈ¡±¾µØÊ±¼ä
time_tÖ»ÊÇÒ»¸ö³¤ÕûÐÍ£¬²»·ûºÏÎÒÃǵÄʹÓÃϰ¹ß£¬ÐèҪת»»³É±¾µØÊ±¼ä£¬¾ÍÒªÓõ½tm½á¹¹£¬time.hÖнṹtmµÄÔ­ÐÍÊÇ£º
struct tm {
        int tm_sec;     /* seconds after the minute - [0,59] */
        int tm_min;     /* minutes after the hour - [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 January 1 - [0,365] */
        int tm_isdst;   /* daylight savings time flag */
       };
¿ÉÒÔ¿´³ö£¬Õâ¸ö»ú¹¹¶¨ÒåÁËÄê¡¢Ô¡¢ÈÕ¡¢Ê±¡¢·Ö¡¢Ãë¡¢ÐÇÆÚ¡¢µ±ÄêÖеÄijһÌì¡¢ÏÄÁîʱ¡£¿ÉÒÔÓÃÕâ¸ö½á¹¹ºÜ·½±ãµÄÏÔʾʱ¼ä¡£
ÓÃlocaltime»ñÈ¡µ±Ç°ÏµÍ³Ê±¼ä£¬¸Ãº¯Êý½«Ò»¸ötime_tʱ¼äת»»³Étm½á¹¹±íʾµÄʱ¼ä


Ïà¹ØÎĵµ£º

cº¯Êýscanf(),printf()µÈ³£Óøñʽ×Ö·û´®

%d   ¶ÌÕûÐÎ,Ò»°ãÕ¼Á½¸ö×Ö½Ú
%u   ÎÞ·ûºÅ¶ÌÕûÐÎ
%ld  ³¤ÕûÐÎ,Ò»°ãÕ¼Ëĸö×Ö½Ú
%c   ×Ö·ûÐÍ
%s    ×Ö·û´®
Ö÷ÒªÓÃÔÚÊäÈëÊä³öº¯Êý£ºscanf(),printf()Àï
\a:·äÃù£¬ÏìÁå
\b:»ØÍË£ºÏòºóÍËÒ»¸ñ
\f:»»Ò³
\n:»»ÐУ¬¹â±êµ½ÏÂÐÐÐÐÊ×
\r:»Ø³µ£¬¹â±êµ½±¾ÐÐÐÐÊ×
\t:Ë®Æ½ÖÆ±í
\v:´¹Ö±ÖƱí ......

¼ÇÒ»µÀC±ÊÊÔÌ⣬¸÷ÖÖâ«Ëö½â·¨¡£

ÉùÃ÷£º´ËÎĵĸ÷ÖÖâ«Ëö½â·¨×ª×Ôµç×Ó¿Æ´óÄÚÍøÂÛ̳£¬¶Ô£¬¾ÍÊÇ×î½üÒò”ÐíÔ¸ÃÅ“¶øÉϸ÷´óÐÂÎÅÍøÕ¾µÄѧУ¡£
ÌâÄ¿ÈçÏ£º
#include "stdio.h"
void print()
{
*
}
void main()
{
}
ÒªÇóÔÚ*ºÅ´¦Ìí¼ÓÓï¾ä£¬³ÌÐòÊä³öhello,world!

ºÃÁË£¬ÎÒÖ±½ÓÌù´ð°¸ÁË£¬ÏàÐÅ´ó¼Ò¶¼¿´µÃ¶®£¬ÓÐЩʵÔÚÊÇâ«Ëö¡£¡£¡ ......

LinuxÖг£ÓõÄC\C++Í·Îļþ

1¡¢  һЩͷÎļþµÄ×÷Óãº
<assert.h>£ºANSI C¡£Ìṩ¶ÏÑÔ£¬assert(±í´ïʽ)
<glib.h>£ºGCC¡£GTK£¬GNOMEµÄ»ù´¡¿â£¬ÌṩºÜ¶àÓÐÓõĺ¯Êý£¬ÈçÓÐÊý¾Ý½á¹¹²Ù×÷º¯Êý¡£Ê¹ÓÃglibÖ»ÐèÒª°üº¬<glib.h>
<dirent.h>£ºGCC¡£Îļþ¼Ð²Ù×÷º¯Êý¡£struct dirent,struct DIR,opendir(),closedir(),readdir(),readdi ......

MISRA C £ºÈÃǶÈëʽϵͳ¸ü¼Ó°²È«¿É¿¿µÄһЩ¹Ø¼ü¹æÔò

ת×Ô£ºhttp://www.bmrtech.com/article/2008/081126.htm
    ûÈËÄÜ·ñÈÏǶÈëʽӦÓÃÕý±äµÃÔ½À´Ô½ÆÕ±é¡£µ«ÊÇ£¬µ±ÏµÍ³Ô½À´Ô½¸´ÔÓ£¬¶øÎÒÃǸ³ÓèϵͳԽÀ´Ô½¶àµÄÔðÈεÄʱºò£¬ÎÒÃǽ«±ØÐëÃæ¶ÔÒ»Ð©ÖØÒªÎÊÌâ¡£ÆäÖÐ×îÖØÒªµÄÎÊÌâÊÇ£ºÎÒÃÇÈçºÎ²ÅÄÜÈ·±£Ç¶ÈëʽϵͳÊǰ²È«¿É¿¿µÄ£¿
C ±à³ÌÓïÑÔΪÓû§ÌṩÁËÐí¶àÇ¿´óµÄ¹¦ÄÜ£¬¼ ......

CºÍC++ÓïÑÔѧϰ×ܽá(Ò»)

CºÍC++ÓïÑÔѧϰ×ܽá(Ò»)
֪ʶ½á¹¹:
1¡¢if,for,switch,goto
2¡¢#define,const
3¡¢Îļþ¿½±´µÄ´úÂë,¶¯Ì¬Éú³ÉÄÚ´æ,¸´ºÏ±í´ïʽ,strcpy,memcpy,sizeof
4¡¢º¯Êý²ÎÊý´«µÝ,ÄÚ´æ·ÖÅ䷽ʽ,ÄÚ´æ´íÎó±íÏÖ,mallocÓënewÇø±ð
5¡¢ÀàÖØÔØ¡¢Òþ²ØÓ븲¸ÇÇø±ð,externÎÊÌâ,º¯Êý²ÎÊýµÄȱʡ
ÖµÎÊÌâ,ºê´úÂëÓëÄÚÁªº¯ÊýÇø±ð
6¡¢¹¹ÔìºÍÎö¹ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ