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

Çó½ân½×HanoiËþÎÊÌâµÄcº¯Êý

#include <stdio.h>
int Count=0;
void move(char x,int n,char z){
 printf(" %d. disk %d: %c => %c\n",++Count,n,x,z);
}//move
// ½«Ëþ×ùxÉÏ°´Ö±¾¶ÓÉСµ½´óÇÒ×ÔÉ϶øϱàºÅΪ1ÖÁnµÄn¸öÔ²ÅÌ°´¹æÔò°áµ½Ëþ×ùzÉÏ£¬y¿ÉÓÃ×÷¸¨ÖúËþ×ù
void Hanoi(int n,char x,char y,char z){
 if (n==1) move(x,1,z); //½«±àºÅΪ£±µÄÔ²ÅÌ´ÓxÒƵ½z
 else{
  Hanoi(n-1,x,z,y);
  move(x,n,z);      //½«±àºÅΪnµÄÔ²ÅÌ´ÓxÒƵ½z
  Hanoi(n-1,y,x,z); //½«yÉϱàºÅΪ£±ÖÁn-1µÄÔ²ÅÌÒƵ½z,x×÷¸¨ÖúËþ
 }
}//Hanoi
void main(void){
 int k;
 printf("\nInput n = ");
 scanf("%d",&k);
 Hanoi(k,'x','y','z');
}//main


Ïà¹ØÎĵµ£º

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

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

CµÄscanf()

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

CµÄÄÚ´æ·ÖÅäÊÍ·Å·½Ê½Ñ§Ï°

Ò»¸öÓÉC/C++±àÒëµÄ³ÌÐòÕ¼ÓõÄÄÚ´æ·ÖΪÒÔϼ¸¸ö²¿·Ö
1¡¢Õ»Çø£¨stack£©— ÓɱàÒëÆ÷×Ô¶¯·ÖÅäÊÍ·Å

£¬´æ·Åº¯ÊýµÄ²ÎÊýÖµ£¬¾Ö²¿±äÁ¿µÄÖµµÈ¡£Æä²Ù×÷·½Ê½ÀàËÆÓÚÊý¾Ý½á¹¹ÖеÄÕ»¡£
2¡¢¶ÑÇø£¨heap£© — Ò»°ãÓɳÌÐòÔ±·ÖÅäÊÍ·Å
£¬
Èô³ÌÐòÔ±²»ÊÍ·Å£¬³ÌÐò½áÊøʱ¿ÉÄÜÓÉOS»ØÊÕ ¡£×¢ÒâËüÓëÊý¾Ý½á¹¹ÖеĶÑÊÇÁ½»ØÊ£¬·ÖÅä·½ ......

CλÔËËã

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

±ê×¼ C I/O

   ±ê×¼ C I/O
º¯ÊýÁÐ±í£º
clearerr() Çå³ý´íÎó
fclose() ¹Ø±ÕÒ»¸öÎļþ
feof() Èç¹ûµ½´ïÎļþβ(end-of-file)·µ»Ø"True"(Õæ)
ferror() ¼ì²éÒ»¸öÎļþ´íÎó
fflush() ÊéдÊä³ö»º´æµÄÄÚÈÝ
fgetc() ´ÓÁ÷»ñÈ¡Ò»¸ö×Ö·û
fgetpos() »ñÈ¡ÎļþλÖÃÖ¸Õë
fgets() ´ÓÒ»¸öÁ÷»ñÈ¡Ò»´®×Ö·û
fopen() ´ò¿ªÒ»¸öÎļþ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ