¡¾×ª¡¿C/C++ ±ÊÊÔ¡¢ÃæÊÔÌâÄ¿´ó»ã×Ü
1.ÇóÏÂÃ溯ÊýµÄ·µ»ØÖµ£¨Î¢Èí£©
int func(x)
{
int countx = 0;
while(x)
{
countx ++;
x = x&(x-1);
}
return countx;
}
¼Ù¶¨x = 9999¡£ ´ð°¸£º8
˼·£º½«xת»¯Îª2½øÖÆ£¬¿´º¬ÓеÄ1µÄ¸öÊý¡£
2. ʲôÊÇ“ÒýÓÔ£¿ÉêÃ÷ºÍʹÓÓÒýÓÔҪעÒâÄÄЩÎÊÌ⣿
´ð£ºÒýÓþÍÊÇij¸öÄ¿±ê±äÁ¿µÄ“±ðÃû”(alias)£¬¶ÔÓ¦ÓõIJÙ×÷Óë¶Ô±äÁ¿Ö±½Ó²Ù×÷Ч¹ûÍêÈ«Ïàͬ¡£ÉêÃ÷Ò»¸öÒýÓõÄʱºò£¬ÇмÇÒª¶ÔÆä½øÐгõʼ»¯¡£ÒýÓÃÉùÃ÷Íê±Ïºó£¬Ï൱ÓÚÄ¿±ê±äÁ¿ÃûÓÐÁ½¸öÃû³Æ£¬¼´¸ÃÄ¿±êÔÃû³ÆºÍÒýÓÃÃû£¬²»ÄÜÔٰѸÃÒýÓÃÃû×÷ΪÆäËû±äÁ¿ÃûµÄ±ðÃû¡£ÉùÃ÷Ò»¸öÒýÓ㬲»ÊÇж¨ÒåÁËÒ»¸ö±äÁ¿£¬ËüÖ»±íʾ¸ÃÒýÓÃÃûÊÇÄ¿±ê±äÁ¿ÃûµÄÒ»¸ö±ðÃû£¬Ëü±¾Éí²»ÊÇÒ»ÖÖÊý¾ÝÀàÐÍ£¬Òò´ËÒýÓñ¾Éí²»Õ¼´æ´¢µ¥Ôª£¬ÏµÍ³Ò²²»¸øÒýÓ÷ÖÅä´æ´¢µ¥Ôª¡£²»Äܽ¨Á¢Êý×éµÄÒýÓá£
3. ½«“ÒýÓÔ×÷Ϊº¯Êý²ÎÊýÓÐÄÄЩÌص㣿
£¨1£©´«µÝÒýÓøøº¯ÊýÓë´«µÝÖ¸ÕëµÄЧ¹ûÊÇÒ»ÑùµÄ¡£Õâʱ£¬±»µ÷º¯ÊýµÄÐβξͳÉΪÔÀ´Ö÷µ÷º¯ÊýÖеÄʵ²Î±äÁ¿»ò¶ÔÏóµÄÒ»¸ö±ðÃûÀ´Ê¹Óã¬ËùÒÔÔÚ±»µ÷º¯ÊýÖжÔÐβαäÁ¿µÄ²Ù×÷¾ÍÊǶÔÆäÏàÓ¦µÄÄ¿±ê¶ÔÏó£¨ÔÚÖ÷µ÷º¯ÊýÖУ©µÄ²Ù×÷¡£
£¨2£©Ê¹ÓÃÒýÓô«µÝº¯ÊýµÄ²ÎÊý£¬ÔÚÄÚ´æÖв¢Ã»ÓвúÉúʵ²ÎµÄ¸±±¾£¬ËüÊÇÖ±½Ó¶Ôʵ²Î²Ù×÷£»¶øʹÓÃÒ»°ã±äÁ¿´«µÝº¯ÊýµÄ²ÎÊý£¬µ±·¢Éúº¯Êýµ÷ÓÃʱ£¬ÐèÒª¸øÐβηÖÅä´æ´¢µ¥Ôª£¬ÐβαäÁ¿ÊÇʵ²Î±äÁ¿µÄ¸±±¾£»Èç¹û´«µÝµÄÊǶÔÏ󣬻¹½«µ÷Óÿ½±´¹¹Ô캯Êý¡£Òò´Ë£¬µ±²ÎÊý´«µÝµÄÊý¾Ý½Ï´óʱ£¬ÓÃÒýÓñÈÓÃÒ»°ã±äÁ¿´«µÝ²ÎÊýµÄЧÂʺÍËùÕ¼¿Õ¼ä¶¼ºÃ¡£
£¨3£©Ê¹ÓÃÖ¸Õë×÷Ϊº¯ÊýµÄ²ÎÊýËäȻҲÄÜ´ïµ½ÓëʹÓÃÒýÓõÄЧ¹û£¬µ«ÊÇ£¬ÔÚ±»µ÷º¯ÊýÖÐͬÑùÒª¸øÐβηÖÅä´æ´¢µ¥Ôª£¬ÇÒÐèÒªÖظ´Ê¹ÓÃ"*Ö¸Õë±äÁ¿Ãû"µÄÐÎʽ½øÐÐÔËË㣬ÕâºÜÈÝÒײúÉú´íÎóÇÒ³ÌÐòµÄÔĶÁÐԽϲÁíÒ»·½Ã棬ÔÚÖ÷µ÷º¯ÊýµÄµ÷Óõ㴦£¬±ØÐëÓñäÁ¿µÄµØÖ·×÷Ϊʵ²Î¡£¶øÒýÓøüÈÝÒ×ʹÓ㬸üÇåÎú¡£
4. ÔÚʲôʱºòÐèҪʹÓÓ³£ÒýÓÔ£¿¡¡
Èç¹û¼ÈÒªÀûÓÃÒýÓÃÌá¸ß³ÌÐòµÄЧÂÊ£¬ÓÖÒª±£»¤´«µÝ¸øº¯ÊýµÄÊý¾Ý²»ÔÚº¯ÊýÖб»¸Ä±ä£¬¾ÍӦʹÓó£ÒýÓᣳ£ÒýÓÃÉùÃ÷·½Ê½£ºconst ÀàÐͱêʶ·û &ÒýÓÃÃû=Ä¿±ê±äÁ¿Ãû£»
Àý1
int a ;
const int &ra=a;
ra=1; //´íÎó
a=1; //ÕýÈ·
Àý2
string f
Ïà¹ØÎĵµ£º
Turbo C 2.0 º¯ÊýÖÐÎÄ˵Ã÷´óÈ«
·ÖÀຯÊý,ËùÔÚº¯Êý¿âΪctype.h
int isalpha(int ch) ÈôchÊÇ×Öĸ('A'-'Z','a'-'z')·µ»Ø·Ç0Öµ,·ñÔò·µ»Ø0
int isalnum(int ch) ÈôchÊÇ×Öĸ('A'-'Z','a'-'z')»òÊý×Ö('0'-'9'),·µ»Ø·Ç0Öµ,·ñÔò·µ»Ø0
int isascii(int ch) ÈôchÊÇ×Ö·û(ASCIIÂëÖеÄ0-127)·µ»Ø·Ç0Öµ,·ñÔò·µ»Ø0
int iscntrl(int ......
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
#include<windows.h>
#include<malloc.h>
#include<math.h>
typedef struct worker
{
int num; //񅧏
char name[15]; //ÐÕÃû
char zhicheng[15];& ......
ËäȻѧϰÁ˺öàÄê,µ«ÐèҪϸ¾¿Ä³Ð©»ù´¡ÖªÊ¶µÄʱºò»¹ÊÇ·¢ÏÖ×Ô¼ºÍüÁË, ´Ó±ðÈ˵ÄÎÄÕ°ǹýÀ´,ÒÔ±¸¸´Ï°
²Î¿¼: http://blog.csdn.net/masefee/archive/2009/12/28/5090820.aspx
============================================================
֮ǰµÄ¶¨Î»¿ÉÄÜÖ÷ҪΪÁËÑо¿µ×²ã¼°Ò»Ð©½Ï¸´ÔÓµÄÎÊÌâÉÏ£¬¶øºöÂÔÁËһЩ³õѧµÄÅóÓÑ¡£µ¼ ......
EBCDIC (Extended Binary Coded Decimal Interchange Code) À©Ôö¶þ½øʽʮ½ø½»»»Â룬ΪIBMÓÚ1963Äê£1964Äê¼äÍƳöµÄ×Ö·û±àÂë±í£¬¸ù¾ÝÔçÆÚ´ò¿×»úʽµÄ¶þ½ø»¯Ê®½øÊý(BCD, Bindary Coded Decimal)ÅÅÁжø³É¡£ÊÇIBMÃÔ¶û¼¶ÒÔÉϵçÄԵıê×¼Âë¡£
ASCII£¨American Standard Code for Information Interchange£¬ÃÀ¹úÐÅÏ¢»¥»»±ê×¼´úÂë£©Ê ......
ûÏëµ½ ûÏëµ½ ÍòÍòûÏëµ½
¶ÔC++°ËÇÏֻͨÁË7ÇϵÄÎÒ£¬¾¹È»Òª¿ªÊ¼¸ãc++Á˵Ä˵£¬ÕæÊǺò»´Ì¼¤¡£
²»¸ÒÏàÐÅ£¬²»¸ÒÏàÐÅ¡£
ÀàÐÍÊÇʲôÍæÒ⣿ÀàÔõôд£¿×Ö·û´®Ôõô´¦Àí£¿ÔõôÊÍ·ÅÄڴ棿
ż²»Öª£¬²»Öª£¬ÕæµÄ²»Öª¡£¡£¡£¡£
°¥ Í궼ÍêÁË¡£
°¦ ²»¹ÜÔõô˵¶¼ÒªÈ¥Ñ§µÄ¡£¡£¡£Ò»µãÕÞ¶¼Ã»ÓÐ
#incl ......