FatFs06.rar
FatFs is a generic file system module to implement the FAT file system to small embedded systems. The FatFs is written in compliance with ANSI C, therefore it is independent of hardware architecture. It can be incorporated into cheap microcontrollers, such as 8051, PIC, AVR, SH, Z80, H8, ARM and etc..., without any change.
標簽:
system
FatFs
file
implement
上傳時間:
2016-11-17
上傳用戶:chenxichenyue
河內(nèi)塔問題
#include<stdio.h>
#include<stdlib.h>
int fun_a(int)
void fun_b(int,int,int,int)
int main(void)
{
int n
int option
printf("題目二:河內(nèi)塔問題\n")
printf("請輸入要搬移的圓盤數(shù)目\n")
scanf("%d",&n)
printf("最少搬移的次數(shù)為%d次\n",fun_a(n))
printf("是否顯示移動過程? 是請輸入1,否則輸入0\n")
scanf("%d",&option)
if(option==1)
{
fun_b(n,1,2,3)
}
system("pause")
return 0
}
int fun_a(int n)
{
int sum1=2,sum2=0,i
for(i=n i>1 i--)
{
sum1=sum1*2
}
sum2=sum1-1
return sum2
}
void fun_b(int n,int left,int mid,int right)
{
if(n==1)
printf("把第%d個盤子從第%d座塔移動到第%d座塔\n",n,left,right)
else
{
fun_b(n-1,left,right,mid)
printf("把第%d個盤子從第%d座塔移動到第%d座塔\n",n,left,right)
fun_b(n-1,mid,left,right)
}
}
標簽:
int
include
stdlib
fun_a
上傳時間:
2016-12-08
上傳用戶:努力努力再努力