关于用顺序栈来解题的问题!!!!!!!!!!!!!!!
#define TURE 1
#define FALSE 0
#define Maxsize 100
typedef int DataType;
typedef struct
{int stack[Maxsize];
int top;
}SeqStack;
#include<stdio.h>
#include"Push.cpp"
#include"Pop.cpp"
#include"StackEmpty.cpp"
#include"InitStack.cpp"
void conversion(int N,int r)
{int x=N,y=r;
SeqStack * s;
s=InitStack();
while(N!=0)
{Push(s,N % r);
N=N/r;
}
printf("\n十进制数%d所对应的%d进制数是: ",x,y);
while(StackEmpty(s)==0)
printf("%d",Pop(s));
printf("\n");
}
main()
{int n,r;
printf("请输入任意一个十进制整数及其所需转换的二至九间的任意进制数:\n");
scanf("%d%d",&n,&r);
conversion(n,r);
}
InitStack.cpp:SeqStack * InitStack()
{SeqStack * S;
S=(SeqStack *)malloc(sizeof(SeqStack));
if(S==0)
{printf("\n空间不足!");
return NULL;
}
else
{S->top=0;
return S;}
}
调试错误:\InitStack.cpp In function `SeqStack* InitStack()':
\InitStack.cpp 'malloc' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
求解答啊,,,,