来看看哪错了
#include<iostream.h>class test()
{
private:
struct number
{
int num;
number *next;
} *first;
public:
void stact(int x);
void pop();
};
void test::stact(int x)
{
number *p=new number;
p->num=x;
if(x==0)
{
p->next=NULL;
}
else
{
p->next=first;
first=p;
}
}
void test::pop()
{
for(struct number p=p->first;p;p=p->next)
cout<<*p->num<<endl;
}
void main()
{
test Test;
int i;
while(i!=0)
{
cin>>i;
Test.stact(i);
}
Test.pop();
}
编译显示:e:\c++文件\stact.cpp(5) : error C2143: syntax error : missing ';' before 'private'
我真的找不出哪里错了