C Ô¤¶¨ÒåµÄºê
C±ê×¼ÖÐÖ¸¶¨ÁËһЩԤ¶¨ÒåµÄºê£¬¶ÔÓÚ±à³Ì¾³£»áÓõ½¡£ÏÂÃæÕâ¸ö±íÖоÍÊÇһЩ³£³£Óõ½µÄÔ¤¶¨Òåºê¡£
__DATE__
½øÐÐÔ¤´¦ÀíµÄÈÕÆÚ£¨“Mmm dd yyyy”ÐÎʽµÄ×Ö·û´®ÎÄ×Ö£©
__FILE__
´ú±íµ±Ç°Ô´´úÂëÎļþÃûµÄ×Ö·û´®ÎÄ×Ö
__LINE__
´ú±íµ±Ç°Ô´´úÂëÖеÄÐкŵÄÕûÊý³£Á¿
__TIME__
Ô´Îļþ±àÒëʱ¼ä£¬¸ñʽ΢“hh£ºmm£ºss”
__func__
µ±Ç°ËùÔÚº¯ÊýÃû
¶ÔÓÚ__FILE__£¬__LINE__£¬__func__ÕâÑùµÄºê£¬ÔÚµ÷ÊÔ³ÌÐòʱÊǺÜÓÐÓõģ¬ÒòΪÄã¿ÉÒÔºÜÈÝÒ×µÄÖªµÀ³ÌÐòÔËÐе½ÁËÄĸöÎļþµÄÄÇÒ»ÐУ¬ÊÇÄĸöº¯Êý¡£
ÏÂÃæÒ»¸öÀý×ÓÊÇ´òÓ¡ÉÏÃæÕâЩԤ¶¨ÒåµÄºêµÄ¡£
#include <stdio.h>
#include <stdlib.h>
void why_me();
int main()
{
printf( "The file is %s.\n", __FILE__ );
printf( "The date is %s.\n", __DATE__ );
printf( "The time is %s.\n", __TIME__ );
printf( "This is line %d.\n", __LINE__ );
printf( "This function is %s.\n", __func__ );
why_me();
return 0;
}
void why_me()
{
printf( "This function is %s\n", __func__ );
printf( "The file is %s.\n", __FILE__ );
printf( "This is line %d.\n", __LINE__ );
}
Ïà¹ØÎĵµ£º
Òý×Ô¡¡http://www.wangchao.net.cn/bbsdetail_625196.html
¡¡¡¡ÔÚVisual C++ 2005ÖУ¬ÈçºÎµ÷ÓÃÆäËü±àÒëÆ÷±àÒëcppÎļþÄØ? »»¾ä»°Ëµ£¬ÈçºÎ°ÑÆäËü±àÒëÆ÷¼¯³Éµ½VC2005µÄIDEÖÐÄØ?
¡¡¡¡ÏóICCÕâÑùµÄ±àÒëÆ÷°²×°Ö®ºó»á×Ô¶¯¼¯³É½øÀ´£¬Òª¼¯³ÉÆäËû±àÒëÆ÷ÄÇ»¹µÃ×Ô¼º¶¯ÊÖ¡£ÏÂÃæ½éÉÜÒ»ÖÖ¼òµ¥¡¢Ç³²ãµÄ“¼¯³É”·½·¨¡£
¡¡¡¡ÄãҲР......
ÕâÒ»ÕÂÎÒÃÇѧϰLinuxµÄʱ¼ä±íʾºÍ¼ÆË㺯Êý
1.ʱ¼äµÄ±íʾ
2.ʱ¼äµÄ²âÁ¿
3.¼ÆʱÆ÷µÄʹÓÃ
--------------------------------------------------------------------------------
1¡£Ê±¼ä±íʾ ÔÚ³ÌÐòµ±ÖÐ,ÎÒÃǾ³£ÒªÊä³öϵͳµ±Ç°µÄʱ¼ä,±ÈÈçÎÒÃÇʹÓÃdateÃüÁîµÄÊ ......
C/C++³ÌÐòԱӦƸ³£¼ûÃæÊÔÌâÉîÈëÆÊÎö(1)
×÷ÕߣºËᦻª e-mail:21cnbao@21cn.com ³ö´¦£ºÈí¼þ±¨
1.ÒýÑÔ
±¾ÎĵÄд×÷Ä¿µÄ²¢²»ÔÚÓÚÌṩC/C++³ÌÐòÔ±ÇóÖ°ÃæÊÔÖ¸µ¼£¬¶øÖ¼ÔÚ´Ó¼¼ÊõÉÏ·ÖÎöÃæÊÔÌâµÄÄÚº¡£ÎÄÖеÄ
´ó¶àÊýÃæÊÔÌâÀ´×Ô¸÷´óÂÛ̳£¬²¿·ÖÊÔÌâ½â´ðÒ²²Î¿¼ÁËÍøÓѵÄÒâ¼û¡£
Ðí¶àÃæÊÔÌâ¿´ËƼòµ¥£¬È´ÐèÒªÉîºñµÄ»ù±¾¹¦²ÅÄܸø³öÍêÃÀ ......
C/C++³ÌÐòԱӦƸ³£¼ûÃæÊÔÌâÉîÈëÆÊÎö(2)
×÷ÕߣºËᦻª e-mail:21cnbao@21cn.com ³ö´¦£ºÈí¼þ±¨
3.ÄÚ¹¦Ìâ
ÊÔÌâ1£º·Ö±ð¸ø³öBOOL£¬int£¬float£¬Ö¸Õë±äÁ¿ Óë“ÁãÖµ”±È½ÏµÄ if Óï¾ä£¨¼ÙÉè±äÁ¿ÃûΪvar£©
½â´ð£º
BOOL ÐͱäÁ¿£ºif(!var)
int ÐͱäÁ¿£º if(var==0)
float ÐͱäÁ¿£º
const float EPSINON = 0.00 ......