i have a problem with the below code
it gives me that there are 5 errors:
Compiling...
asdfsa.cpp
c:\documents and settings\ahmed aburumman\desktop\ljdf\asdfsa.cpp(9) : error C2258: illegal pure syntax, must be '= 0'
c:\documents and settings\ahmed aburumman\desktop\ljdf\asdfsa.cpp(9) : error C2252: 'MAX' : pure specifier can only be specified for functions
c:\documents and settings\ahmed aburumman\desktop\ljdf\asdfsa.cpp(10) : error C2065: 'MAX' : undeclared identifier
c:\documents and settings\ahmed aburumman\desktop\ljdf\asdfsa.cpp(10) : error C2057: expected constant expression
c:\documents and settings\ahmed aburumman\desktop\ljdf\asdfsa.cpp(10) : warning C4200: nonstandard extension used : zero-sized Array in struct/union
c:\documents and settings\ahmed aburumman\desktop\ljdf\asdfsa.cpp(11) : error C2229: Class 'stack' has an illegal zero-sized Array
Error executing cl.exe.
asdfsa.obj - 5 error(s), 1 warning(s)
Can somebody help?(im using a microsoft visual c++ 6.0 compiler if this means anything)
Code:
#include <iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
class stack
{
private:
static const int MAX=10;
int st[MAX];
int top;
public:
stack():top(-1){}
void push(int v){st[++top]=v;}
int pop(){return st[top--];}
bool isempty(){return (top==-1);}
bool isfull(){return top==MAX-1;}
void print()
{
while(!isempty())
cout<<pop()<<endl;
}
void print_reve()
{
int i=0;
while(i!=MAX)
cout<<st[i++]<<endl;
}
};
int main(int argc, char *argv[])
{
srand(time(0));
stack s;
while(!s.isfull())
s.push(rand()%1000+1);
s.print();
cout<<"--------\n";
s.print_reve();
cin.get();
return 0;
}

