65,210
社区成员
发帖
与我相关
我的任务
分享
//LZ 注意了C++头文件的定义规则哦!
//1.用#include <iostream>时候学要加上using namespace std;命名空间的!
//2.或者用C语言头文件的形式,#include <iostream.h>,#include <stdlib.h>
#include <iostream>
#include <cstdlib>
using namespace std;//问题在这哦
const int Ms = 20;
//定义常量为20
struct Student{
int num;
//学号
double grade;
//成绩
};
typedef Student ElemType;
//定义ElemType为Student类型
struct ListSq{
ElemType *list;
//存线性表元素
int len;
//存线性表长度
int MaxSize;
//存List数长度,即所能存储的长度
};
void InitList(ListSq& L);
//初始置空线性表,即置各域值为0
void InitList(ListSq& L,int ms);
//分配MS大小的线性表空间
ElemType GetElemList(ListSq& L,int pos);
//得到线性表好、中第pos个元素的值
int SeqFindList(ListSq L,ElemType item);
//从线性表顺序查找一个元素,返回该元素位置
int BinFindList(ListSq& L,ElemType item);
//从线性表中二分查找一个元素,返回该元素位置
bool ModifyList(ListSq& l,const ElemType item);
//修改线性表中第一个指定元素
void TailInsertList(ListSq& L,ElemType item);
//向线性表尾部插入一个元素
void OrderInserList(ListSq& L,ElemType item);
//向线性表有序位置插入一个元素
bool DeleteList(ListSq& L,ElemType item);
//从线性表中删除第一元素
bool EmptyList(ListSq& L);
//判断线性表是否为空
int LenthList(ListSq& L);
//求线性表长度
void OutputList(ListSq& L);
//遍历输出线性表
void SortListl(ListSq& L);
//按元素的值或关键字对顺序存储的线性表就地排序
ListSq SortList2(const ListSq& L);
//清除线性表中的所有元素,释放线性表中动态存储空间
void ClearList(ListSq& L);
static bool operator == (const ElemType& s1,const ElemType& s2)
{
return s1.num == s2.num;
}
static bool operator < (const ElemType& s1,const ElemType& s2)
{
return s1.num < s2.num;
}
static ostream& operator<<(ostream& ostr,const ElemType& s)
{
ostr<<s.num<<' '<< s.grade<<' ';
return ostr;
}
int main()
{
cout<<"Successful!"<<endl;
return 0;
}
#include <iostream>
using namespace std;
#include <iostream>
#include <stdlib.h>
const int Ms = 20;
//定义常量为20
struct Student{
int num;
//学号
double grade;
//成绩
};
typedef Student ElemType;
//定义ElemType为Student类型
struct ListSq{
ElemType *list;
//存线性表元素
int len;
//存线性表长度
int MaxSize;
//存List数长度,即所能存储的长度
};
void InitList(ListSq& L);
//初始置空线性表,即置各域值为0
void InitList(ListSq& L,int ms);
//分配MS大小的线性表空间
ElemType GetElemList(ListSq& L,int pos);
//得到线性表好、中第pos个元素的值
int SeqFindList(ListSq L,ElemType item);
//从线性表顺序查找一个元素,返回该元素位置
int BinFindList(ListSq& L,ElemType item);
//从线性表中二分查找一个元素,返回该元素位置
bool ModifyList(ListSq& l,const ElemType item);
//修改线性表中第一个指定元素
void TailInsertList(ListSq& L,ElemType item);
//向线性表尾部插入一个元素
void OrderInserList(ListSq& L,ElemType item);
//向线性表有序位置插入一个元素
bool DeleteList(ListSq& L,ElemType item);
//从线性表中删除第一元素
bool EmptyList(ListSq& L);
//判断线性表是否为空
int LenthList(ListSq& L);
//求线性表长度
void OutputList(ListSq& L);
//遍历输出线性表
void SortListl(ListSq& L);
//按元素的值或关键字对顺序存储的线性表就地排序
ListSq SortList2(const ListSq& L);
//清除线性表中的所有元素,释放线性表中动态存储空间
void ClearList(ListSq& L);
static bool operator == (const ElemType& s1,const ElemType& s2)
{
return s1.num == s2.num;
}
static bool operator < (const ElemType& s1,const ElemType& s2)
{
return s1.num < s2.num;
}
static ostream& operator << (ostream& ostr,const ElemType& s)
{
ostr << s.num << ' ' <<s.grade << ' ';
return ostr;
}
int main()
{
cout << "test"<<endl;
return 0;
}