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

C³ÌÐòÉè¼ÆµÄ³£ÓÃËã·¨


¡¡¡¡Ëã·¨£¨Algorithm£©£º¼ÆËã»ú½âÌâµÄ»ù±¾Ë¼Ïë·½·¨ºÍ²½Öè¡£Ëã·¨µÄÃèÊö£ºÊǶÔÒª½â¾öÒ»¸öÎÊÌâ»òÒªÍê³ÉÒ»ÏîÈÎÎñËù²ÉÈ¡µÄ·½·¨ºÍ²½ÖèµÄÃèÊö£¬°üÀ¨ÐèҪʲôÊý¾Ý£¨ÊäÈëʲôÊý¾Ý¡¢Êä³öʲô½á¹û£©¡¢²ÉÓÃʲô½á¹¹¡¢Ê¹ÓÃʲôÓï¾äÒÔ¼°ÈçºÎ°²ÅÅÕâЩÓï¾äµÈ¡£Í¨³£Ê¹ÓÃ×ÔÈ»ÓïÑÔ¡¢½á¹¹»¯Á÷³Ìͼ¡¢Î±´úÂëµÈÀ´ÃèÊöËã·¨¡£
¡¡¡¡Ò»¡¢¼ÆÊý¡¢ÇóºÍ¡¢Çó½×³ËµÈ¼òµ¥Ëã·¨
¡¡¡¡´ËÀàÎÊÌⶼҪʹÓÃÑ­»·£¬Òª×¢Òâ¸ù¾ÝÎÊÌâÈ·¶¨Ñ­»·±äÁ¿µÄ³õÖµ¡¢ÖÕÖµ»ò½áÊøÌõ¼þ£¬¸üҪעÒâÓÃÀ´±íʾ¼ÆÊý¡¢ºÍ¡¢½×³ËµÄ±äÁ¿µÄ³õÖµ¡£
¡¡¡¡Àý£ºÓÃËæ»úº¯Êý²úÉú100¸ö[0£¬99]·¶Î§ÄÚµÄËæ»úÕûÊý£¬Í³¼Æ¸öλÉϵÄÊý×Ö·Ö±ðΪ1£¬2£¬3£¬4£¬5£¬6£¬7£¬8£¬9£¬0µÄÊýµÄ¸öÊý²¢´òÓ¡³öÀ´¡£
¡¡¡¡±¾ÌâʹÓÃÊý×éÀ´´¦Àí£¬ÓÃÊý×éa[100]´æ·Å²úÉúµÄÈ·100¸öËæ»úÕûÊý£¬Êý×éx[10]À´´æ·Å¸öλÉϵÄÊý×Ö·Ö±ðΪ1£¬2£¬3£¬4£¬5£¬6£¬7£¬8£¬9£¬0µÄÊýµÄ¸öÊý¡£¼´¸öλÊÇ1µÄ¸öÊý´æ·ÅÔÚx[1]ÖУ¬¸öλÊÇ2µÄ¸öÊý´æ·ÅÔÚx[2]ÖУ¬……¸öλÊÇ0µÄ¸öÊý´æ·ÅÔÚx[10]¡£
void main()
{
int a[101],x[11],i,p;
for(i=0;i<=11;i++)
x=0;
for(i=1;i<=100;i++)
{
a=rand() % 100;
printf("%4d",a);
if(i%10==0)printf("\n");
}
for(i=1;i<=100;i++)
{
p=a%10;
if(p==0) p=10;
x[p]=x[p]+1;
}
for(i=1;i<=10;i++)
{
p=i;
if(i==10) p=0;
printf("%d,%d\n",p,x);
}
printf("\n");
}
¡¡¡¡¶þ¡¢ÇóÁ½¸öÕûÊýµÄ×î´ó¹«Ô¼Êý¡¢×îС¹«±¶Êý
¡¡¡¡·ÖÎö£ºÇó×î´ó¹«Ô¼ÊýµÄË㷨˼Ï룺(×îС¹«±¶Êý=Á½¸öÕûÊýÖ®»ý/×î´ó¹«Ô¼Êý)
(1) ¶ÔÓÚÒÑÖªÁ½Êým£¬n£¬Ê¹µÃm>n£»
(2) m³ýÒÔnµÃÓàÊýr£»
(3) Èôr=0£¬ÔònΪÇóµÃµÄ×î´ó¹«Ô¼Êý£¬Ëã·¨½áÊø£»·ñÔòÖ´ÐÐ(4)£»
(4) m←n£¬n←r£¬ÔÙÖظ´Ö´ÐÐ(2)¡£
ÀýÈç: Çó m=14 ,n=6 µÄ×î´ó¹«Ô¼Êý. m n r
14 6 2
6 2 0
void main()
{
int nm,r,n,m,t;
printf("please input two numbers:\n");
scanf("%d,%d",&m,&n);
nm=n*m;
if (m<n)
{ t=n; n=m; m=t; }
r=m%n;
while (r!=0)
{ m=n; n=r; r=m%n; }
printf("×î´ó¹«Ô¼Êý:%d\n",n);
printf("×îС¹«±¶Êý:%d\n",nm/n);
}
¡¡¡¡Èý¡¢ÅжÏËØÊý
¡¡¡¡Ö»Äܱ»1»ò±¾ÉíÕû³ýµÄÊý³ÆΪËØÊý »ù±¾Ë¼Ï룺°Ñm×÷Ϊ±»³ýÊý£¬½«2—INT£¨£©×÷Ϊ³ýÊý£¬Èç¹û¶¼³ý²»¾¡£¬m¾ÍÊÇËØÊý£¬·ñÔò¾Í²»ÊÇ¡££¨¿ÉÓÃÒÔϳÌÐò¶ÎʵÏÖ£©
void main()
{
int m,i,k;
printf("please input a number:\n");
scanf("%d",&m);
k=sqrt(m);
for(i=2;i<k;i++)
if(m%i==


Ïà¹ØÎĵµ£º

android ±àÒëNative CµÄhello,worldÄ£¿é

±àÒëNative CµÄhello,worldÄ£¿é
    Android ±àÒë»·¾³±¾Éí±È½Ï¸´ÔÓ£¬ÇÒ²»ÏñÆÕͨµÄ±àÒë»·¾³£ºÖ»Óж¥²ãĿ¼Ï²ÅÓÐMakefileÎļþ£¬¶øÆäËûµÄÿ¸öcomponent¶¼Ê¹ÓÃͳһ±ê×¼µÄ Android.mk. Android.mkÎļþ±¾ÉíÊDZȽϼòµ¥µÄ£¬²»¹ýËü²¢²»ÊÇÎÒÃÇÊìϤµÄMakefile£¬¶øÊǾ­¹ýÁËAndroid×ÔÉí±àÒëϵͳµÄºÜ¶à´¦Àí£¬Òò´ËÒªÕæÕýÀ ......

CµÄscanf()

ºÃ¾ÃûÉÏÀ´ÁË...Óеã¶Ô²»Æð×Ô¼ºµÄÁ¼ÐÄ...
»°ËµÕâ¶Îʱ¼ä¿ì¸øÕâ¸öº¯Êý¸ãËÀÁË...
ÎÒÕÒÕÒ...ÎÒÕÒÎÒÕÒ...ÎÒ¾ÍÊÇÒª°ÑËü¸ø¸ãÃ÷°×ÁË...
»°ËµÇ°¶Îʱ¼äÄǸöËÀÈËËÄÔòÔËËãÒ²°Ñ×Ô¼º¸ãµÃ°ëËÀÁË...¶î...ÏÖÔÚ»¹ÔÚÍ£¹¤×´Ì¬...ÔÎËÀ....
ÔÙ˵scanf(),ÉÏÍøÊÇ¿ÉÒÔÕÒµ½Ð©¶«Î÷....µ«ÊǶ¼²»ÔõôÃ÷°×...´òËã×Ô¼º¸ãÃ÷°×ÁËÔÙÉÏÀ´Ð´¸öÏêϸµãµÄ°É... ......

CλÔËËã

12.1       λÔËËã·û£ÃÓïÑÔÌṩÁËÁùÖÖλÔËËã·û£º
    &          °´Î»Óë
    |          °´Î»»ò
    ^     &nb ......

linux+vim+gcc+gdb¿ª·¢C/C++³ÌÐò»·¾³´î½¨

ÎÒÓõÄÊÇubuntu²Ù×÷ϵͳ¡£´ò¿ªÖÕ¶Ë
1.sudo apt-get install vim(vim-full Õâ¸öÈí¼þ×Ô9.10°æ±¾±»·ÏÆúÁË£¬²»ÂÛÔõôÌí¼ÓÈí¼þÔ´¶¼ÕÒ²»µ½µÄ£¬ËùÒÔÖ±½Ó°²×°vim¾Í¿ÉÒÔÁË£¬£¬Ò²¿ÉÒÔ°²×°gvim£¬£¬ÔÚÐÂÁ¢µÃÈí¼þÀïÃæËÑË÷vim¾Í¿ÉÒÔÕÒµ½ÁË)
2.
sudo apt-get install build-essential // build-essentialÊÇcÓïÑԵĿª·¢°ü£¬°üº¬ÁËgcc ma ......

c±àÒë¹ý³Ì

±àÒëµÄ¸ÅÄ±àÒë³ÌÐò¶ÁÈ¡Ô´³ÌÐò£¨×Ö·ûÁ÷£©£¬¶ÔÖ®½øÐдʷ¨ºÍÓï·¨µÄ·ÖÎö£¬½«¸ß¼¶ÓïÑÔÖ¸Áîת»»Îª¹¦ÄܵÈЧµÄ»ã±à´úÂ룬ÔÙÓÉ»ã±à³ÌÐòת»»Îª»úÆ÷ÓïÑÔ£¬²¢ÇÒ°´ÕÕ²Ù×÷ϵͳ¶Ô¿ÉÖ´ÐÐÎļþ¸ñʽµÄÒªÇóÁ´½ÓÉú³É¿ÉÖ´ÐгÌÐò¡£
    ±àÒëµÄÍêÕû¹ý³Ì£ºCÔ´³ÌÐò£­£­>Ô¤±àÒë´¦Àí(.c)£­£­>±àÒë¡¢ÓÅ»¯³ÌÐò£¨.s¡¢.asm£©£­£­>»ã± ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ