CÓïÑÔÔ¤±àÒë³öÀ´ÃüÁî
Ò»¡¢ºê¶¨Òå(²»´ø²ÎÊýµÄºê¶¨Òå,´ø²ÎÊýµÄºê¶¨Òå)
1.±àÒëÔ¤´¦Àí¾ÍÊǶÔCÔ´³ÌÐò½øÐбàÒëÇ°,ÓÉ"±àÒëÔ¤´¦Àí³ÌÐò"¶ÔÔ¤´¦ÀíÃüÁîÐнøÐд¦ÀíµÄ¹ý³Ì¡£
2.CÓïÑÔÖÐ,·²ÊÇÒÔ"#"¿ªÍ·µÄÐÐ,¶¼³ÆΪ"±àÒëÔ¤´¦Àí"ÃüÁîÐС£
CÓïÑÔÖеıàÒëÔ¤´¦ÃüÁîÓÐ:#define,#undef,#include,#if,#else,#elif,#endif,#ifdef,#ifndef,#line,#pragma,#error¡£ÕâЩԤ´¦ÀíÃüÁî×é³ÉµÄÔ¤´¦ÀíÃüÁîÐбØÐëÔÚÒ»ÐеĿªÍ·ÒÔ"#"ºÅ¿ªÊ¼,ÿÐеÄδβ²»µÃ¼Ó";"ºÅ,ÒÔÇø±ðÓÚCÓï¾ä¡¢¶¨ÒåºÍ˵Ã÷Óï¾ä¡£
3.²»´ø²ÎÊýµÄºê¶¨Òå:ÃüÁîµÄÒ»°ãÐÎʽΪ:
#define ±êʶ·û ×Ö·û´®
¶¨ÒåÖеÄ"±êʶ·û"ΪÓû§¶¨ÒåµÄ±êʶ·û,³ÆΪºêÃû¡£ÔÚÔ¤±àÒëʱ,CÔ¤±àÒë³ÌÐò½«³öÏֵĺêÃûÌæ»»³É"×Ö·û´®"µÄÄÚÈÝ,ÕâÒ»¹ý³ÌÒ²³ÆΪºêÕ¹¿ª¡£
4.´ø²ÎÊýµÄºê¶¨Òå:ÃüÁîµÄÒ»°ãÐÎʽΪ
#defineºêÃû(ÐÎʽ²ÎÊý) ×Ö·û´®
¶¨ÒåÖеÄ"×Ö·û´®"Ó¦°üº¬À¨ºÅÖÐËùÖ¸¶¨µÄÐÎʽ²ÎÊý¡£×¢ÒâºêÃûÓëÀ¨ºÅÖ®¼ä²»Òª¼Ó¿Õ¸ñ,·ñÔò¾Í³ÉΪ²»´ø²ÎÊýµÄºê¶¨ÒåÁË¡£
5.Ô¤±àÒëʱ,Óöµ½´øʵ²ÎµÄºêÃû,Ôò°´ÃüÁîÐÐÖÐÖ¸¶¨µÄ×Ö·û´®´Ó×óµ½ÓÒ½øÐÐÖû»,ÔÔòÊÇ:
Óöµ½Êµ²ÎÔòÒÔʵ²Î´úÌæ,·ÇÐβÎ×Ö·ûÔÑù±£Áô,´Ó¶øÐγÉÕ¹¿ªºóµÄÄÚÈÝ¡£
¶þ¡¢“Îļþ°üº¬”´¦Àí
1.Îļþ°üº¬µÄÒ»°ãÐÎʽΪ:
#include"Í·ÎļþÃû"#include<Í·ÎļþÃû>
Í·ÎļþÃûÒ»°ãÓÉCÓïÑÔÌṩ,Ò²¿ÉÒÔÊÇÓû§×Ô¼º±àдµÄ,Í·Îļþͨ³£ÓÃ.h×÷Ϊºó׺¡£
2.µ±Í·ÎļþÃûÓÃË«ÒýºÅÀ¨ÆðÀ´Ê±,ϵͳÊ×ÏÈÔÚʹÓôËÃüÁîµÄÎļþËùÔÚµÄĿ¼ÖвéÕÒ±»°üº¬µÄÎļþ,ÕÒ²»µ½Ê±,ÔÙ°´ÏµÍ³Ö¸¶¨µÄ±ê×¼·½Ê½¼ìË÷ÆäËüĿ¼;µ±Í·ÎļþÃûÓüâÀ¨ºÅÀ¨ÆðÀ´Ê±,ÔòÖ±½Ó°´ÏµÍ³Ö¸¶¨µÄ±ê×¼¼ìË÷·½Ê½²éÕÒ±»°üº¬µÄÎļþ¡£
3.Ô¤±àÒëʱ,½«±»°üº¬ÎļþµÄÄÚÈÝÈ«²¿¸´ÖƵ½°üº¬ÎļþÖÐ,Õâ¾ÍÊÇÎļþ"°üº¬´¦Àí"¡£
Èý¡¢Ìõ¼þ±àÒë
CÓïÑÔÖеÄÌõ¼þ±àÒëÃüÁî¿É¶ÔÔ´³ÌÐò´úÂëµÄ¸÷²¿·ÖÓÐÑ¡ÔñµØ½øÐбàÒë¡£Ìõ¼þ±àÒëÖ÷ÒªÓÐÈçÏÂ3ÖÖʹÓøñʽ:
ʹÓøñʽ1:
#ifdef±êʶ·û
³ÌÐò¶Î1
#else
³ÌÐò¶Î2
#endif
ʹÓøñʽ2:
#ifndef±êʶ·û
³ÌÐò¶Î1
#else
³ÌÐò¶Î2
#endif
ʹÓøñʽ3:
#if±í´ïʽ
³ÌÐò¶Î1
#else
³ÌÐò¶Î2
#endif
ʹÓøñʽ1±íʾÈç¹ûÒѶ¨ÒåÁË“±êʶ·û”,Ôò±àÒ듳ÌÐò¶Î1”,·ñÔò±àÒ듳ÌÐò¶Î2”;ʹÓøñʽ2±íʾÈçûÓж¨ÒåÁË“±êʶ·û”,Ôò±àÒ듳ÌÐò¶Î1”,·ñÔò±àÒ듳ÌÐò¶Î2”;ʹÓøñʽ3±íʾÈ瓱í´ïʽ”µÄֵΪ“Õæ”ʱ,Ôò±àÒ듳ÌÐò¶Î1”,·ñÔò±àÒ듳ÌÐò¶Î2”¡£
Ïà¹ØÎĵµ£º
http://en.wikipedia.org/wiki/C_preprocessor
C preprocessor
from Wikipedia, the free encyclopedia
Jump to:navigation, search
The C preprocessor (cpp) is the preprocessor for the C programming language. In many C implementations, it is a separate program invoked by the compiler as the first part ......
void mystery(int n)
{
n += 5;
n /= 10;
printf(" :%s\n","***********" + 10 -n);
}
µ±Ò»¸ö×Ö·û´®³£Á¿Î»ÓÚÒ»¸ö±í´ïʽÖÐʱ£¬ËüµÄÖµÊÇÒ»¸öÖ¸Õë³£Á¿¡£±àÒëÆ÷°ÑÕâЩָ¶¨×Ö·ûµÄÒ»·Ý¿½±´´æ´¢ÔÚÄÚ´æµÄij¸öλÖ㬲¢´æ´¢Ò»¸öÖ¸ÏòµÚ1¸ö×Ö·ûµÄÖ¸Õë¡£µ«ÊÇ£¬µ±Êý×éÃûÓÃÓÚ±í´ïʽÖÐʱ£¬ËûÃǵÄÖµÒ²ÊÇÒ»¸öÖ¸Õë³£Á¿ ......
̽Ë÷еÄC + +ºÍMFCÔÚVisual Studio 2010¹¦ÄÜ
Sumit Kumar
2010ÄêÁгöµÄVisual Studio C + +¿ª·¢µÄ¾Þ´óºÃ´¦¡£´Ó¹ÍÓÃÄÜÁ¦ÌṩÓÉWindows 7´óÁ¿´úÂëµÄ»ù´¡¹¤×÷£¬ÒÔÔöÇ¿Éú²úÁ¦ÌØÕ÷µÄÐÂÌص㣬ÓÐһЩеĶ«Î÷£¬Ìá¸ßÁ˼¸ºõËùÓеÄC + +¿ª·¢ÈËÔ±¡£
ÔÚÕâƪÎÄÕÂÖУ¬ÎÒ½«½âÊÍ΢ÈíÒѾ½â¾öÁËÈçºÎÓÃC + +¿ª·¢ÈËÔ±ËùÃæÁٵĹ㷺µÄһЩÎÊÌ ......
ÕâÈýÕÂÖ÷Òª½²ÁËCÓïÑÔµÄÁ´½Ó¡¢¿âº¯Êý¡¢Ô¤´¦Àí¡£»¹ÊÇÓеã»ÞɬÄѶ®°¡¡£
Ò»¸öC³ÌÐòÊÇ¿ÉÒÔÓжà¸ö²¿·Ö×é³ÉµÄ£¬µ«ÊDZàÒëÆ÷ÿ´ÎÖ»ÄܱàÒëÒ»¸öÎļþ£¬ÕÒ³öÆäÖеĴíÎó¡£Ä³Ð©CÓïÑÔʵÏÖÌṩÁËÒ»¸ö³ÆΪlintµÄ³ÌÐò£¬¿ÉÒÔ²¶»ñ´óÁ¿µÄ´ËÀà´íÎó¡£Á¬½ÓÆ÷Ò»°ãÊÇÓë±àÒëÆ÷·ÖÀëµÄ£¬±àÒëÆ÷ÊÇ°ÑC³ÌÐò“·Ò딳ɶÔÁ¬ ......
Ëü¿ÉÒÔµ¼Èë¿â£¬µ÷ÓÃÍâÃæµÄ¿âº¯Êý£¬javaÓïÑԾͺܺõĵØÀûÓÃÁËÕâÒ»µã£¬jspÒ²¿ÉÒÔÔÚÍøÒ³Öе÷ÓÃjava±àдºÃµÄ³ÌÐò£¬ÒªÊ¹ÓÃjavabean±êÇ©
struts±¾Éí¾ÍÊǶÔjava¼¼ÊõÒ»¸ö°ü×°,°üÀ¨£¬html,jsp¼°±êÇ©,servlet¡£
hibernateÊDZðÈ˱àдºÃÓ³ÉäÊý¾Ý¿âµÄ¹¤¾ß£¬Æä´úÂ붼ÊÇÓÃjavaÓïÑÔ±àдµÄ£¬Ö»ÊÇΪÁË·½±ãÓû§Ê¹Óã¬Óû§Ö»Òªµ¼ÈëÆä¿â£¬µ÷ÓÃÆ ......