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

ÎҵĵÚÒ»個C³Ìʽ

時間²»µÈÈË£¬ÔÚÎÒ還δÀÏȥ֮ǰ£¬Ïë°Ñ丟µôµÄC³ÌʽÖØÐÂÔÙ揀Æð來¡£
Èë門£¬½¨議£¨ÎÒÒ²ÊÇÐÂÊÖ£©²»Òª¿´譚´ó爺µÄ書£¬對ÓÚ20ÊÀ紀學習C語ÑÔ£¬c Primer Plus 5thÎÒ認為ÊÇÒ»個ºÃµÄ選擇¡£
ÎҵĵÚÒ»個C³Ìʽ£¬»ØÏë當Ä꣬ÊǶà÷á興奮¡£¡£¡£
#include <stdio.h>
int main()
{
printf("hello yichang\n");
int num;
num=0;
int i;
for (i=1;i<=100;i++)
{
num=num+i;
if(num==5050){
printf("%d=%d\n",i,num);}else{
printf("%d+",i);
}
}
printf("1+2+3...+98+99+100 ,total is: 10½øÖÆ:%#d,8½øÖÆ:%#o...“ÎÞǰ׺±íʾ,%d,%o”\nÓÐÃξÍÈ¥×ö±ð¹ÜÌìʲôʱºòÁÁ!!!\n",num,num,num,num);   //“#”ºÅÏÔʾCǰ׺
return 0;
}


Ïà¹ØÎĵµ£º

C/C++: Ê®Áù½øÖÆת10½øÖÆÔ´Âë ÊÕ²Ø

C/C++: Ê®Áù½øÖÆת10½øÖÆÔ´Âë
ÊÕ²Ø



view plain
copy to clipboard
print
?
int
 hex_char_value(
char
 c)  
{  
    if
(c >= 
'0'
 && ......

Ò»¸öLinuxÏÂCÏ̳߳صÄʵÏÖ

ʲôʱºòÐèÒª´´½¨Ï̳߳ØÄØ£¿¼òµ¥µÄ˵£¬Èç¹ûÒ»¸öÓ¦ÓÃÐèҪƵ·±µÄ´´½¨ºÍÏú»ÙỊ̈߳¬¶øÈÎÎñÖ´ÐеÄʱ¼äÓַdz£¶Ì£¬ÕâÑùÏ̴߳´½¨ºÍÏú»ÙµÄ´øÀ´µÄ¿ªÏú¾Í²»ÈݺöÊÓ£¬ÕâʱҲÊÇÏ̳߳ظóö³¡µÄ»ú»áÁË¡£Èç¹ûÏ̴߳´½¨ºÍÏú»Ùʱ¼äÏà±ÈÈÎÎñÖ´ÐÐʱ¼ä¿ÉÒÔºöÂÔ²»¼Æ£¬ÔòûÓбØҪʹÓÃÏ̳߳ØÁË¡£
ÏÂÃæÊÇLinuxϵͳÏÂÓÃCÓïÑÔ´´½¨µÄÒ»¸öÏ̳߳ء£Ï̳߳ػ ......

C/C++ÖеÄ64λÕûÊý£¨__int64 and long long£©

¡¡¡¡ÔÚ×öACMÌâʱ£¬¾­³£¶¼»áÓöµ½Ò»Ð©±È½Ï´óµÄÕûÊý¡£¶ø³£ÓõÄÄÚÖÃÕûÊýÀàÐͳ£³£ÏÔµÃ̫СÁË£ºÆäÖÐlong ºÍ int
·¶Î§ÊÇ[-2^31,2^31)£¬¼´-2147483648~2147483647¡£¶øunsigned·¶Î§ÊÇ[0,2^32)£¬¼´
0~4294967295¡£Ò²¾ÍÊÇ˵£¬³£¹æµÄ32λÕûÊýÖ»Äܹ»´¦Àí40ÒÚÒÔϵÄÊý¡£
¡¡¡¡ÄÇÓöµ½±È40ÒÚÒª´óµÄÊýÔõô°ìÄØ£¿Õâʱ¾ÍÒªÓõ½C++µÄ64λÀ©Õ¹ ......

cÖ¸Õë

cÖ¸ÕëµÄÔËËãÓÐʱºò»¹ÊǺÜÃÔ»óÈ˵ġ£
ÀýÈ磺
struct student {
int num;
int score;
int length;
};
struct student *pt;
pt = (struct student *) malloc(sizeof(struct student));
pt->num = 1;
pt->score = 90;
pt->length = 3 * sizeof(int);
printf("pt length:%d\n", *pt);
pt = (int ......

[C/C++] °ÑÒ»¸öÕûÐÍÕûÊýת³É×Ö·û´®

ÎÊÌâÃèÊö£ºÐ´Ò»¸öº¯Êý£¬½ÓÊÜÒ»¸öÕûÊý£¨¼Ù¶¨ÓÃint±íʾ£©£¬Êä³ö¸ÃÕûÊýµÄ×Ö·û´®ÐÎʽ¡£²ÉÓÃÈçϺ¯ÊýÔ­ÐÍ£º
void itoa ( int val, buf* );
ÕâÀï¼Ù¶¨buf×ã¹»´óÒÔÈÝÄÉÈκÎintÀàÐÍÊýÖµµÄ×Ö·û´®¡£
Õâ¸öÎÊÌ⣬³õ¿´ºÃÏñûÓÐʲôÄѶȡ£Èç¹ûÊÇ0£¬¾ÍÖ±½ÓÊä³ö'0'£»Èç¹ûÊÇÕýÊý£¬¾Íͨ¹ýÈ¡Ä£(%)ºÍÇóÉÌ(/)ÔËËã¿ÉÒÔÖðλȡµÃ¸ÃÕûÊýµÄÊý×Ö£¬²¢° ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ