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

¡¶±à³ÌÖéçá¡·ÖеÄÎÊÌâÓÃCʵÏÖ——1

ÎÊÌâÃèÊö£ºÒ»Ë³ÐòÎļþÖÐÖÁ¶à´æÔÚ10000000¸ö¼Ç¼£¬Ã¿Ìõ¼Ç¼¶¼ÊÇÒ»¸ö7λÕûÊý£¬Çë¶Ô´ËÎļþÖÐÊý¾Ý½øÐÐÅÅÐò¡£
ÒªÇó£º1.³ÌÐò¿ÉʹÓÃÄÚ´æÖ»ÓÐ1MB¡£2.³ÌÐòÔËÐÐʱ¼ä¾¡¿ÉÄܵĶ̡£
²¹³ä˵Ã÷£ºÃ¿¸ö¼Ç¼¶¼ÊÇÒ»¸ö7λÕýÕûÊý£¬²¢ÇÒûÓÐÆäËûµÄ¹ØÁªÊý¾Ý£¬Ã¿¸öÕûÊýÖÁ¶àÖ»ÄܳöÏÖÒ»´Î¡£
ʵÏÖ¸ÙÒª£º
ÔÚÏÖʵÖУ¬Î»Í¼ºÍλÏòÁ¿ºÜ³£¼û£¬ÎÒÃÇ¿ÉÒÔʹÓÃÒ»¸ö20λµÄ×Ö·û´®À´±íʾһ¸öСÐ͵ÄСÓÚ20µÄ·Ç¸ºÕûÊý¼¯ºÏ¡£ÀýÈ磺ÎÒÃÇ¿ÉÒÔ½«¼¯ºÏ£û1£¬2£¬3£¬5£¬8£¬13£ý´æ´¢ÔÚÏÂÃæÕâ¸ö×Ö·û´®ÖУº01110100100001000000.¼¯ºÏÖдú±íÊý×Ö µÄ¸÷¸öλÉèÖÃΪ1£¬¶øÆäËûµÄλȫ²¿¶¼ÉèΪ0.
      ÔÚÏÖʵÎÊÌâÖУ¬Ã¿¸öÕûÊýµÄ7¸öÊ®½øÖÆÊý×Ö±íʾÁËÒ»¸öСÓÚǧÍòµÄÊý×Ö¡£ÎÒÃǽ«Ê¹ÓÃÒ»¸ö¾ßÓÐһǧÍòλµÄ×Ö·û´®±íʾ¸ÃÎļþ£¬ÔÚ¸Ã×Ö·û´®ÖУ¬µ±ÇÒ¹«µ±ÕûÊýiÔÚ¸ÃÎļþÖÐʱ£¬µÚi¸öλ²Å´ò¿ª£¨ÉèΪ1£©¡£
ʵÏÖ´úÂ룺
1.λ²Ù×÷Í·Îļþ£ºbit.h
 #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#ifndef BIT_H
#define BIT_H
#define BIT_SIZE 10000000
#define BIT_UNIT int
unsigned int GetBitUnitSize(void);
unsigned int GetBitArraySize(void);
void InitBitArray(BIT_UNIT *p);
void SetBitValue(BIT_UNIT *p, unsigned int bit, short val);
unsigned short GetBitValue(BIT_UNIT *p, unsigned int bit);
void PrintArrayList(BIT_UNIT *p);
BIT_UNIT SetIndexBitValue(unsigned short index);
#endif

2.λ²Ù×÷cÎļþ£ºbit.c
#include "bit.h"
unsigned int GetBitUnitSize(void)
{
return sizeof(BIT_UNIT) * 8;
}
unsigned int GetBitArraySize(void)
{
return BIT_SIZE / GetBitUnitSize();
}
void InitBitArray(BIT_UNIT *p)
{
int array_size = GetBitArraySize();
int unit_size = GetBitUnitSize();
int i = 0;
for (i = 0; i < array_size; i++)
*(p + i) = *(p + i) << unit_size;
}
void SetBitValue(BIT_UNIT *p, unsigned int bit, short val)
{
if (bit >= BIT_SIZE) return;
unsigned int array_size = GetBitArraySize();
unsigned short unit_size = GetBitUnitSize();
unsigned int unit_index = bit / unit_size;
unsigned short bit_index = bit % unit_size;
if (bit_index == 0) {
unit_index--;
bit_index = unit_size;
}


Ïà¹ØÎĵµ£º

ANSI C——¿É±ä²ÎÊý


¡¾Ô­ÐÍ¡¿
      type fun( type arg1, type arg2, ...
);
¡¾ÃèÊö¡¿
       Ö÷ÒªÓÃÔÚ²ÎÊý¸öÊý²»È·¶¨µÄº¯ÊýÖУ¬ÀýÈ磺printfº¯Êý¡£
¡¾Ê¹Ó÷½·¨¡¿
²Î¿¼£ºglib/manual/Add.c
#include <stdarg.h>
#include <stdio.h>
int add_em_up (int coun ......

¹¹½¨×Ô¼ºµÄC/C++²å¼þ¿ª·¢¿ò¼Ü——ϵÁÐ

ÕâһϵÁÐÎÄÕÂÊÇÎÒ¹¹½¨C/C++²å¼þ¿ª·¢¿ò¼Ü¿ª·Å¿ò¼ÜµÄ¹ý³Ì¡£ºóÃæ»áÒ»Ö±¸üУ¬Ö±ÖÁ¹¹½¨Íê³É¡£
¡¶¹¹½¨×Ô¼ºµÄC/C++²å¼þ¿ª·¢¿ò¼Ü£¨Ò»£©——³õ²½ÉèÏë¡·
¡¶¹¹½¨×Ô¼ºµÄC/C++²å¼þ¿ª·¢¿ò¼Ü£¨¶þ£©——×ÜÌ幦ÄÜ¡·
¡¶
¹¹½¨×Ô¼ºµÄC/C++²å¼þ¿ª·¢¿ò¼Ü£¨Èý£©——×ÜÌå½á¹¹
¡·
¡¶¹¹½¨×Ô¼ºµÄC/C++²å¼þ¿ª·¢¿ò¼ ......

ECLIPSE ¿ª·¢ C/C++ ¹¤³Ì

  ×î½üÒ»¸öÅóÓÑ×¼±¸°ÑC´úÂëÔÚECLIPSEÉϱàÒ룬ÒÔÇ°Ò»Ö±¸ãµÄJAVA£¬Ò²ÖªµÀECLIPSEÖ§³ÖC¹¤³Ì£¬µ«ÊÇ×Ô¼º´ÓÀ´Ã»¸ã¹ý£¬ËùÒÔ¾Í×Ô¼ºÏÈ´ÓÍøÂçÉÏÕÒ×ÊÁÏ£¬Ö÷Òª·½·¨ÈçÏÂ
1¡¢°²×°JDKºÍEclipse
ÕâÀï¾Í²»¶à˵£¬¾ßÌåÇë¼û£ºhttp://blog.chinaunix.net/u/16292/showart_223309.html
Îҵݲװ»·¾³ÊÇjdk1.5£¬eclipse3.2.1
2¡¢°²×°C++µÄE ......

C++ÖÐextern ¡°C¡±º¬ÒåÉî²ã̽Ë÷

1.ÒýÑÔ
¡¡¡¡C++ÓïÑԵĴ´½¨³õÖÔÊÇ“a better C”£¬µ«ÊÇÕâ²¢²»Òâζ×ÅC++ÖÐÀàËÆCÓïÑÔµÄÈ«¾Ö±äÁ¿ºÍº¯ÊýËù²ÉÓõıàÒëºÍÁ¬½Ó·½Ê½ÓëCÓïÑÔÍêÈ«Ïàͬ¡£×÷ΪһÖÖÓûÓëC¼æÈݵÄÓïÑÔ£¬C++±£ÁôÁËÒ»²¿·Ö¹ý³ÌʽÓïÑÔµÄÌص㣨±»ÊÀÈ˳ÆΪ“²»³¹µ×µØÃæÏò¶ÔÏ󔣩£¬Òò¶øËü¿ÉÒÔ¶¨Òå²»ÊôÓÚÈκÎÀàµÄÈ«¾Ö±äÁ¿ºÍº¯Êý¡£µ«ÊÇ£¬C++±Ï¾ ......

Ò»µÀC±ÊÊÔÌâ

Author: Scurffybear Date: 2009.09.08
×î½üÔÚÕÐÐÂÈË£¬ÏÂÃæÊÇÒ»µÀCµÄÃæÊÔÌ⣬ÃæÊÔµÄÓ¡¶ÈÈËÖУ¬Ã»ÓÐÒ»¸öÈË×ö¶Ô£¬ÎÒ´Ö¿´ÁËÒ»ÏÂÌ⣬ÔÚûÓп´´ð°¸Ç°£¬ÎÒ×Ô¼ºÒ²×ö´íÁË£¬àÅ£¬Êǵģ¬Ã»É¶²»ºÃÒâ˼µÄ£¬ÎÒ¾õµÃÕâ¸öÌâÄ¿ºÜÈÝÒ×ʹÈ˲úÉúÎó½â£¬ÓÖ»òÕßÔñ£ÃÓÐÉîºñ¹¦µ×µÄÈËÄܶã¹ýÕâÒ»¸öÕÏÑÛ·¨£¿
ÒÔÏÂÊÇÌâÄ¿£¬
main()
{
char * ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ