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

²»ÓÃÁÙʱ±äÁ¿½»»»Á½¸öÊýµÄÖµ(CʵÏÖ)

µ±Òª½»»»Á½¸öÊýµÄֵʱ£¬Í¨³£µÄ×ö·¨ÊǶ¨ÒåÒ»¸öÁÙʱ±äÁ¿£¬È»ºóÔÙ½øÐн»»»¡£ÄÇôÄܲ»Äܲ»ÓÃÁÙʱ±äÁ¿¶ø½»»»Á½¸öÊýµÄÖµÄØ£¿¿ÉÒԵģ¡CÓïÑÔÌṩµÄÒì»òÔËËã¾Í¿ÉÒÔʵÏÖÕâÑùµÄ²Ù×÷¡£
 
Òì»òÔËËã·û^Ò²³ÆXORÔËËã·û£¬ËüµÄ¹æÔòÊÇÈô²Î¼ÓÔËËãµÄÁ½¸ö¶þ½øλͬºÅ£¬Ôò½á¹ûΪ0£¨¼Ù£©£»ÒìºÅΪ1£¨Õ棩¡£¼´0 ^ 0 = 0, 0 ^ 1 = 1, 1 ^ 0 = 1, 1 ^ 1 = 0¡£
 
Àý£º
#include <stdio.h>
int main(int argc, char *argv[])
{
    int a = 2, b = 6;
    a = a ^ b;
    b = b ^ a;
    a = a ^ b;
    printf("a = %d b = %d\n", a, b);
    return 0;
}
½á¹ûÈçÏÂ: a = 6 b = 2
·ÖÎö£ºÇ°Á½¸ö¸³ÖµÓï¾ä£º“a = a ^ b£»”ºÍ“b = b ^ a£»”Ï൱ÓÚb = b ^ (a ^ b)£¬¶øb ^ a ^ bµÈÓÚa ^ b ^ b¡£b ^ bµÄ½á¹ûΪ0£¬ÒòΪͬһ¸öÊýÓëÏàÏòÏà^£¬½á¹û±ØΪ0¡£Òò´ËbµÄÖµµÈÓÚa ^ 0£¬¼´a£¬ÆäֵΪ2¡£
ÔÙÖ´ÐеÚÈý¸ö¸³ÖµÓï¾ä£º“a = a ^ b”¡£ÓÉÓÚaµÄÖµµÈÓÚ(a ^ b)£¬bµÄÖµµÈÓÚ(b ^ a ^ b)£¬Òò´Ë£¬Ï൱ÓÚa = a ^ b ^ b ^ a ^ b£¬¼´aµÄÖµµÈÓÚa ^ a ^ b ^ b ^ b£¬µÈÓÚb¡£
ÁíÍâÁ½ÖÖ·½·¨:
·½·¨Ò»:
void swap(int *p, int *q)
{
    *p = *p + *q;
    *q = *p - *q;
    *p = *p - *q;
}
·½·¨¶þ:
void swap(int *p, int *q)
{
    *p = *p + *q - (*q = *p);
}
Ô­ÀíΪËãÊõÔËËã·ûµÄ½áºÏ˳ÐòΪ×Ô×óÖÁÓÒ¡£
×¢:¿ÉÒÔ°ÑÒì»òµÄÈýÌõÓï¾äѹËõΪһÌõ£ºa ^= b ^= a ^= b;
Òª½»»»Èý¸ö±äÁ¿µÄÖµ,ÓÃÏÂÃæ±äÁ¿»á±¨´í:c = a + c - (a = b, b = c);
ÏÂÃæÀ´·ÖÎöһϣ¬ÏÈ¿´Ò»¸öʾÀý³ÌÐò£¬ÈçÏ£º
#include <stdio.h>
int main(int argc, char *argv[])
{
    int a = 1;
    int b = 2;
    int c = 3;
    c = a + c - (a = b, b = c);
    printf("a = %d\n", a);
    printf("b = %d\n", b);
    printf("c = %d\n", c);
    return 0;
}
±àÒëÔËÐУ¬½á¹ûÈçÏ£ºa = 2 b = 3 c = 2
¿É¼û£¬×î³õÄ¿±êÖеÄc = 1²¿·ÖûÄÜʵÏÖ¡£ÓÚÊÇ·ÖÎöÔ­Òò£º


Ïà¹ØÎĵµ£º

¹ØÓÚCµÄ±ä³¤²ÎÊý

ijЩÇé¿öÏÂÏ£Íûº¯ÊýµÄ²ÎÊý¸öÊý¿ÉÒÔ¸ù¾ÝÐèҪȷ¶¨¡£µäÐ͵ÄÀý×ÓÓдó¼ÒÊìϤµÄº¯Êýprintf()¡¢scanf()ºÍϵͳµ÷ÓÃexecl()µÈ¡£ÄÇôËüÃÇÊÇÔõÑùʵÏÖµÄÄØ£¿C±àÒëÆ÷ͨ³£ÌṩÁËһϵÁд¦ÀíÕâÖÖÇé¿öµÄºê£¬ÒÔÆÁ±Î²»Í¬µÄÓ²¼þƽ̨Ôì³ÉµÄ²îÒ죬Ôö¼Ó³ÌÐòµÄ¿ÉÒÆÖ²ÐÔ¡£ÕâЩºê°üÀ¨va_start¡¢ va_argºÍva_endµÈ¡£
²ÉÓÃANSI±ê×¼ÐÎʽʱ£¬²ÎÊý¸öÊý¿É± ......

cÎļþ²Ù×÷£¬¼æÈݶà×Ö½ÚºÍunicode

ÔÚ<TCHAR.h>Í·ÎļþÀÓÐÕâôһ×é²Ù×÷ÎļþµÄºê
       #define _tfdopen    _wfdopen
      
#define _tfsopen    _wfsopen
      
#define _tfopen     _wfope ......

c/c++Èí¼þ¿ª·¢µÄ×¢ÒâÊÂÏî

µÚÒ»²¿·ÖÈí¼þ±à³ÌµÄʱ¼ä·ÖÅä¸Å¿ö
   ¸ßЧÂʵijÌÐòÔ±²¢²»ÊÇÇüüÅ̵ÄËٶȱȱðÈ˿죬¶øÊÇËûÓÐ×ÅÁ¼ºÃµÄ±à³ÌÏ°¹ß£¬½ÚÊ¡Á˱ðÈËÀ˷ѵÄʱ¼ä¡£Òò´Ë£¬ÒªÏëÌá¸ß×Ô¼ºµÄ±à³ÌЧÂÊ£¬¸ù±¾ÔÚÓÚÔõôÉÙÀË·Ñʱ¼ä¡£Ö»ÒªÄܰѱðÈËÀ˷ѵÄʱ¼ä½ÚÊ¡ÏÂÀ´£¬ÄãµÄЧÂʾͿÉÒÔ¿ì¹ý±ðÈË£¬ÉõÖÁÊý±¶ÓÚ±ðÈË¡£ÒªÏë½Úʡʱ¼ä£¬µ±È»Ê×ÏÈÐèÒªÃ÷°×±à³ÌÖкķ ......

TURBO C 2.0 Îļþ·ÖÀà

 
 2009-12-24          21:15:41
 
TURBO C 2.0 Îļþ·ÖÀà
 
·Ô­´´·
ÍøÉÏÏÂÔØTURBO C 2.0ºÜ»ìÂÒ£¬Ò»Ö±Ïë°ÑËýÕûÀíһϣ¬Ê¹¸÷¸öʵÀý·Ö¿ª£¬¸÷¸ö²»Í¬²¿·Ö·Ö¿ª¡£¶Ï¶ÏÐøÐø»¨Á˺ܳ¤Ê±¼ä£¬µ½½ñÌìÖÕÓÚÕûÀíÍêÁË¡£·¢Ìû³öÀ´¸ø´ó¼Ò¿´¿´¡£ÓÐÐèÒªµÄ ......

CÓëC++µÄÇø±ð

1. C++ËäÈ»Ö÷ÒªÊÇÒÔCµÄ»ù´¡·¢Õ¹ÆðÀ´µÄÒ»ÃÅÐÂÓïÑÔ£¬µ«Ëý²»ÊÇCµÄÌæ´úÆ·£¬²»ÊÇCµÄÉý¼¶£¬C++ºÍCÊÇÐֵܹØϵ¡£Ã»ÓÐË­±ÈË­ÏȽøµÄ˵·¨£¬¸üÖØÒªµÄÒ»µãÊÇCºÍC++¸÷×Եıê׼ίԱ»áÊǶÀÁ¢µÄ£¬×îеÄC++±ê×¼ÊÇC++98£¬×îеÄC±ê×¼ÊÇC99¡£Òò´ËҲûÓÐÏÈѧCÔÙ˵C++µÄ˵·¨£¬Ò²²»ÔÙ£¨×¢ÒâÕâ¸ö"²»ÔÙ"£©ÓÐC++Óï·¨ÊÇCÓï·¨µÄ³¬¼¯µÄ˵·¨¡£
2. C++/CL ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ