谁能帮我在gcc里面编译下面的程序啊?
hanoi.h:#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
extern int cnt;
int get_n_from_user(void);
void move(int n,char a,char b,char c);
main.c:
#include "hanoi.h"
int cnt=0;
int main(void){
int n;
n=get_n_from_user();
assert(n>0);
move(n,'A','B','C');
return 0;
}
get.c;
#include <hanoi.h>
int get_from_user(void){
int n;
printf("%s",
"---\n"
"TOWERS OF HANOI:\n"
"\n"
"There are three towers:A,B,and C.\n"
"\n"
"The disk on tower A must be moved to tower C.Only one\n"
"disk can be moved at time,and the order on each tower\n"
"must be preserved at each step.Any of the towers A,B,\n"
"or C can be used for intermediate placement of a disk.\n"
"\n"
"Input n: ");
"if(scanf("%d",&n)!=1||n<1){
printf("\nEROR:Positive integer not found-bye!\n\n");
exit(1);
}
printf("\n");
return n;
}
move.c:
#include "hanoi.h"
void move(int n,char a,char b,char c){
if(n==1){
++cnt;
printf("%5d: %s%d%s%c%c.\n",cnt,
"Move disk ",1,"from tower",a," to tower",c)
}
else{
move(n-1,a,c,b);
++cnt;
printf("%5d: %s%d%s%c%c.\n",cnt,
"Move disk",n,"from tower",a,"to tower",c);
move(n-1,b,a,c);
}
}