const int MAX = 100;
const int TRUE = 0;
const int FALSE = 1;
//const int TOP = top;class stack
{
private:
int top;
char* num[MAX];
char cFinval;
char cDelval;
public:
Stack(char* num[]);
int Pop(char* num[]);
int Push(char* num[]);
bool Isempty(char* num[]);
bool Isfull(char* num[]);
int Find(char* num[],char cFinval);
int Delet(char* num[],char cDelval);
};
stack::Stack(char *num[])
{
top = -1;
}
bool stack::Isempty(char* num[])
{
if (top == -1)
return TRUE;
else 
return FALSE;
}
bool stack::Isfull(char* num[])
{
if (top == MAX)
return TRUE;
else 
return FALSE;
}
int stack::Pop(char* num[])
{
while(!Isempty (char* num[]))
{
return *num[top];
top--;
} return 1;
}
int stack::Push(char* num[])
{
while(!Isfull (char* num[]))
{
top++;
*num[top] = *value;
}
return 1;
}
int stack::Find(char* num[],char cFinval)
{
while(*num[top] == cFinval)
{
return top;
top--;
}
return 1;
}
int stack::Delet(char* num[],char cDelval)
{
while(*num[top] == cDelval)
{
return *num[top];
*num[top] = *num[top-1];
top--;
}
return 1;
}
E:\c++\crc_text\stack.cpp(44) : error C2144: syntax error : missing ')' before type 'char'
E:\c++\crc_text\stack.cpp(44) : error C2660: 'Isempty' : function does not take 0 parameters
E:\c++\crc_text\stack.cpp(44) : error C2059: syntax error : ')'
E:\c++\crc_text\stack.cpp(45) : error C2143: syntax error : missing ';' before '{'
E:\c++\crc_text\stack.cpp(54) : error C2144: syntax error : missing ')' before type 'char'
E:\c++\crc_text\stack.cpp(54) : error C2660: 'Isfull' : function does not take 0 parameters
E:\c++\crc_text\stack.cpp(54) : error C2059: syntax error : ')'
E:\c++\crc_text\stack.cpp(55) : error C2143: syntax error : missing ';' before '{'
E:\c++\crc_text\stack.cpp(57) : error C2065: 'value' : undeclared identifier
E:\c++\crc_text\stack.cpp(57) : error C2100: illegal indirection

解决方案 »

  1.   

    1. Stack(char* num[]); <-- 好像是小写 stack
      

  2.   

    stack::Stack(char *num[]) <-- 这里也应当是小写 stack2.while(!Isempty (char* num[])) <-- 应当是 while(!Isempty (num))
    while(!Isfull (char* num[])) <-- while(!Isfull (num))3.int stack::Push(char* num[])
      <-- 缺少 value 参数 int stack::Push(char* num[], char value)
    申明的地方也改成 int Push(char* num[], char value);
    *num[top] = *value; <<-- *num[top] = value;4.最最最最大的一个大错误, 你不应当传递 char * num, 这个不是class
      的内部变量吗?