C++问题请高手看看那里不对

来源:百度知道 编辑:UC知道 时间:2024/06/09 07:05:05
#include<iostream>

using namespace std;

class MyArray
{
public:
MyArray(int leng)
{
length = leng;
alist = new int[length];
}

~MyArray()
{
delete []alist;
}

void input()
{

for(int index=0; index<length; ++index)
{
cin>>alist[index];
}
cout<<endl;
}

void Display()
{
for(int index=0; index<length; ++index)
{
cout<<alist[index]<<" ";
}
cout<<endl;
}

protected:
int *alist;

int length;
};

class SortArray : public MyArray
{
public:

SortArray(int leng) : MyArray(leng)
{}

void paixu()
{
int index,ix,t;
for(index=0; index<length; ++index)
{
for(ix=(index+1); ix<length; ++ix)
{
if(alist[i

定义类SortArray的语句的最后一个"}"后面缺少一个";"

不明白“打印出来数据不对的,是益处的”是什么意思?
程序修改以后,执行到哪一步输出结果不对呢?