问题遇到的现象和发生背景
操作#include"iostream"
using namespace std;
#define maxsize 100
#define OK 1
#define OVERFLOW 0
typedef int Elemtype;
typedef status
{
ElemType *elem;
int length;
}SqList;
int InitList(SqList &L)
{
L.elem=new ElemType[maxsize];
if(!L.elem) exit(OVERFLOW);
L.length=0;
return OK;
}
void InputList(SqList &L,int n)
{
cout<<"请输入数字,以0为终止"<<endl;
cin>>n;
for(n!=0)
{
L.elem[L.length++]=n;
cin>>n;
}
}
void OutputList(SqList &L)
{
ElenType n;
for(n=0;n<L.length;n++)
{
cout<<L.elem[n]<<endl;
}
}
int main()
{
SqList L;
if(InitList(L))
{
InputList(L);
}
else
{
return 1;
}
return 0;
}环境、软件版本等信息