#include <iostream>
using namespace std;
struct ArrayStack
{
int top;
int capacity;
int *array;
};
ArrayStack* createStack(int cap)
{
ArrayStack *stack=new ArrayStack();
stack->capacity=cap;
stack->array= new int[stack->capacity];
return stack;
}
int isFull(ArrayStack *stack)
{
if(stack->top>=stack->capacity-1)
{
return 1;
}
else
{
return 0;
}
}
int isEmpty(ArrayStack *stack)
{
if(stack->top<0)
{
return 1;
}
else
{
return 0;
}
}
void push(ArrayStack *stack, int item)
{
if(!isFull(stack))
{
stack->top += 1;
stack->array[stack->top]=item;
}
else
{
cout<<"Sorry Stack is Full ! iteam cannot be store"<<endl;
}
}
int pop(ArrayStack *stack)
{
int item;
if(isEmpty(stack))
{
cout<<"Sorry stack is Empty"<<endl;
return -1;
}
else
{
item=stack->array[stack->top];
stack->top--;
return item;
}
}
int main()
{
return 0;
}
我在Dev-C ++中遇到此错误: $(CPP)$(LINKOBJ)-o $(BIN)$(LIBS)
,在Visual Studio中,我遇到此错误:
错误3错误LNK1169:找到一个或多个乘法定义的符号H:\ study \ programs \ data_structure \ Data_struchers_inC ++ \ Debug \ Data_struchers_inC ++。exe 1 1 Data_struchers_inC ++