[問題] 如何用組合語言寫河內塔
用C語言很快就能寫出來河內塔的程式....只要用遞回就可以了,但是,我將他改成
組合語言之後就會出問題...#include <stdio.h>
#include<stdlib.h>
void hanoi(int n, char A, char B, char C)
{
if(n == 1)
printf("Move sheet %d from %c to %c\n", n, A, C);
else
{
hanoi(n-1, A, C, B);
printf("Move sheet %d from %c to %c\n", n, A, C);
hanoi(n-1, B, A, C);
}
}
int main()
{
int n;
printf("請輸入盤數:");
scanf("%d", &n);
hanoi(n, 'A', 'B', 'C');
system("pause");
return 0;
}
這是我寫的C語言..要怎麼寫成組合語言呢
希望大家幫幫忙/.\
PS:我是用Masm615去編譯的
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.114.222.151
推
11/04 14:15, , 1F
11/04 14:15, 1F
→
11/04 16:01, , 2F
11/04 16:01, 2F
→
11/04 16:02, , 3F
11/04 16:02, 3F
→
11/04 16:03, , 4F
11/04 16:03, 4F
→
11/04 16:09, , 5F
11/04 16:09, 5F
→
11/04 22:42, , 6F
11/04 22:42, 6F
推
11/05 02:32, , 7F
11/05 02:32, 7F
討論串 (同標題文章)
ASM 近期熱門文章
PTT數位生活區 即時熱門文章