list.h
来自「《c++语言程序设计》例题程序」· C头文件 代码 · 共 39 行
H
39 行
//Begin of file list.h
class List; //前向引用声明
class Point //Point类的声明
{
public: //外部接口
Point(float xx=0, float yy=0) {X=xx;Y=yy;}
void SetPoint(float xx, float yy) {X=xx;Y=yy;}
float GetX() {return X;}
float GetY() {return Y;}
friend class List; //声明友元类
private: //私有数据成员
float X,Y;
};
class Node //Node类的声明
{
public: //外部接口
friend class List; //声明友元类
private: //私有成员
Node(float x=0, float y=0):p_node(x,y){next=0;}
Point p_node;
Node *next;
};
class List //List类的声明
{
public: //外部接口
List(){list=0;}
List(float x, float y) {list=new Node(x,y);}
int Print(); //输出链表
void Append(float x, float y); //建立链表
float Linefit(); //线性回归计算
int GetLength(); //统计链表节点数
private:
Node *end(); //指向链尾函数
Node *list;
};
//End of file list.h
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?