帮我看看急
#include <iostream>
template <class A>
{
private:
<A> *p;
<A> size;
<A> _number;
//定义数据
public:
A(<A> size=20,<A> _number=10,<A> *p=0);
~A();
bool fuzhi(<A> *p);
bool insert(int i,int x);
bool shanchu1(int i);
bool find(int i);
bool shanchu(<A> *p);
//对其私有成员操作的函数接口
}
bool <A>::fuzhi(<A> *p)
{
<A> *p=new <A>[size];
for(int a=0;a<10;a++)
{
<A> *p[a]=a+1;
}
return 1;
}
bool <A>::insert(int i,int x)
{
if(i<0||i>size||i==0)
{
return 0;
}
else if(_number>size)
{
return 0;
}
else if(i>0||i<=_number)
{
int b;
i=b;
_number++;
for(int c=1;c<=_number-i;c++)
{
*p[b]=*p[b+c];
}
return 1;
}
else if(i>0||i<=size||i>_number)
{
x=*p[i];
_number++;
}
}
bool <A>::shanchu1(int i)
{
if(i<0||i>size)
{
return 0;
}
else if(_number=0)
{
return 0;
}
else if(i>0||i>_number||i<=size)
{
cout<<"点不存在"<<endl;
return 0;
}
else if(i>0||i<=_number)
{
0=*p[i];
_number--;
}
}
bool <A>::find(int i)
{
if(i<0||i>_number||_number=0)
{
return 0;
}
else if(i>0||i<=number)
{
cout<<"*p[i]="<<*p[i]<<endl;
}
}
bool <A>::shanchu(<A> *p)
{
delete [] *p;
return 1;
}
int main()
{
int i=10;
int x=30;
<int> duixiang;
if(duixiang.fuzhi)
{
cout<<"true"<<endl;
}
if(duixiang.insert)
{
cout<<"true"<<endl;
}
if(duixiang.shanchu1)
{
cout<<"true"<<endl;
}
if(duixiang.find)
{
cout<<"true"<<endl;
}
if(duixiang.shanchu)
{
cout<<"true"<<endl;
}
return 0;
}
厄 刚刚学完C++。。写了个 数据结构的类帮我看看哪里错了。。用VC6.0 给我报出40个错下面的错误信息
C:\Documents and Settings\user\桌面\6825602.cpp(18) : error C2059: syntax error : '<end Parse>'
C:\Documents and Settings\user\桌面\6825602.cpp(19) : warning C4091: '' : ignored on left of 'bool' when no variable is declared
C:\Documents and Settings\user\桌面\6825602.cpp(19) : error C2143: syntax error : missing ';' before '<'
C:\Documents and Settings\user\桌面\6825602.cpp(19) : error C2143: syntax error : missing ';' before '<'
C:\Documents and Settings\user\桌面\6825602.cpp(19) : error C2039: 'fuzhi' : is not a member of '`global namespace''
C:\Documents and Settings\user\桌面\6825602.cpp(20) : error C2143: syntax error : missing ';' before '{'
C:\Documents and Settings\user\桌面\6825602.cpp(20) : error C2447: missing function header (old-style formal list?)
C:\Documents and Settings\user\桌面\6825602.cpp(28) : warning C4091: '' : ignored on left of 'bool' when no variable is declared
C:\Documents and Settings\user\桌面\6825602.cpp(28) : error C2143: syntax error : missing ';' before '<'
C:\Documents and Settings\user\桌面\6825602.cpp(28) : error C2143: syntax error : missing ';' before '<'
C:\Documents and Settings\user\桌面\6825602.cpp(28) : error C2039: 'insert' : is not a member of '`global namespace''
C:\Documents and Settings\user\桌面\6825602.cpp(29) : error C2143: syntax error : missing ';' before '{'
C:\Documents and Settings\user\桌面\6825602.cpp(29) : error C2447: missing function header (old-style formal list?)
C:\Documents and Settings\user\桌面\6825602.cpp(55) : warning C4091: '' : ignored on left of 'bool' when no variable is declared
C:\Documents and Settings\user\桌面\6825602.cpp(55) : error C2143: syntax error : missing ';' before '<'
C:\Documents and Settings\user\桌面\6825602.cpp(55) : error C2143: syntax error : missing ';' before '<'
C:\Documents and Settings\user\桌面\6825602.cpp(55) : error C2039: 'shanchu1' : is not a member of '`global namespace''
C:\Documents and Settings\user\桌面\6825602.cpp(56) : error C2143: syntax error : missing ';' before '{'
C:\Documents and Settings\user\桌面\6825602.cpp(56) : error C2447: missing function header (old-style formal list?)
C:\Documents and Settings\user\桌面\6825602.cpp(76) : warning C4091: '' : ignored on left of 'bool' when no variable is declared
C:\Documents and Settings\user\桌面\6825602.cpp(76) : error C2143: syntax error : missing ';' before '<'
C:\Documents and Settings\user\桌面\6825602.cpp(76) : error C2143: syntax error : missing ';' before '<'
C:\Documents and Settings\user\桌面\6825602.cpp(76) : error C2039: 'find' : is not a member of '`global namespace''
C:\Documents and Settings\user\桌面\6825602.cpp(77) : error C2143: syntax error : missing ';' before '{'
C:\Documents and Settings\user\桌面\6825602.cpp(77) : error C2447: missing function header (old-style formal list?)
C:\Documents and Settings\user\桌面\6825602.cpp(87) : warning C4091: '' : ignored on left of 'bool' when no variable is declared
C:\Documents and Settings\user\桌面\6825602.cpp(87) : error C2143: syntax error : missing ';' before '<'
C:\Documents and Settings\user\桌面\6825602.cpp(87) : error C2143: syntax error : missing ';' before '<'
C:\Documents and Settings\user\桌面\6825602.cpp(87) : error C2039: 'shanchu' : is not a member of '`global namespace''
C:\Documents and Settings\user\桌面\6825602.cpp(88) : error C2143: syntax error : missing ';' before '{'
C:\Documents and Settings\user\桌面\6825602.cpp(88) : error C2447: missing function header (old-style formal list?)
C:\Documents and Settings\user\桌面\6825602.cpp(96) : error C2143: syntax error : missing ';' before '<'
C:\Documents and Settings\user\桌面\6825602.cpp(97) : error C2065: 'duixiang' : undeclared identifier
C:\Documents and Settings\user\桌面\6825602.cpp(97) : error C2228: left of '.fuzhi' must have class/struct/union type
C:\Documents and Settings\user\桌面\6825602.cpp(99) : error C2065: 'cout' : undeclared identifier
C:\Documents and Settings\user\桌面\6825602.cpp(99) : error C2297: '<<' : illegal, right operand has type 'char [5]'
C:\Documents and Settings\user\桌面\6825602.cpp(99) : error C2065: 'endl' : undeclared identifier
C:\Documents and Settings\user\桌面\6825602.cpp(101) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\user\桌面\6825602.cpp(103) : error C2297: '<<' : illegal, right operand has type 'char [5]'
C:\Documents and Settings\user\桌面\6825602.cpp(105) : error C2228: left of '.shanchu1' must have class/struct/union type
C:\Documents and Settings\user\桌面\6825602.cpp(107) : error C2297: '<<' : illegal, right operand has type 'char [5]'
C:\Documents and Settings\user\桌面\6825602.cpp(109) : error C2228: left of '.find' must have class/struct/union type
C:\Documents and Settings\user\桌面\6825602.cpp(111) : error C2297: '<<' : illegal, right operand has type 'char [5]'
C:\Documents and Settings\user\桌面\6825602.cpp(113) : error C2228: left of '.shanchu' must have class/struct/union type
C:\Documents and Settings\user\桌面\6825602.cpp(115) : error C2297: '<<' : illegal, right operand has type 'char [5]'
Error executing cl.exe.
6825602.exe - 40 error(s), 5 warning(s)