顺序表-学生成绩

#include  
const int MaxSize=10;  
class Student  
{  
public:  
    Student(){length=0;}  
    Student(float a[],int n);  
    ~Student(){}  
    void Insert(int i,float x);  
    int Length(){return length;}  
    int Delete(int i);  
    int Locate(float x);  
    void Print();  
private:  
    float data[MaxSize];  
    int length;  
};  
Student::Student(float a[],int n)  
{  
    if(n>MaxSize)throw"参数非法";  
    for(int i=0;i=MaxSize)throw"上溢";  
    if(i<1||i>length+1)throw"位置非法";  
    for(int j=length;j>=i;j--)  
        data[j]=data[j-1];  
    data[i-1]=x;  
    length++;  
}  
int Student::Delete(int i)  
{  
    if(length==0)throw"下溢";  
    if(i<1||i>length)throw"位置非法";  
    float x=data[i-1];  
    for(int j=i;j

顺序表-学生成绩_第1张图片

你可能感兴趣的:(顺序表-学生成绩)