# 求链表中的最大值，节点个数，平均值

//头文件
#ifndef LIST_H
#define LIST_H

#include
#include
using namespace std;
template
public:
T data;
{

}
data = item;
}
};
template
class List{

private:
public:
List();
~List();
void Append(const T value);//为链表赋值,规定链表长度
void clear();
void print();

T MaxValue();
int Count();
T Average();
};
template
T List::MaxValue()
{
T maxValue = 0;
while (p != NULL)
{
if (maxValue < (p->data))
maxValue = p->data;
}
return maxValue;
}

template
int List::Count()
{
int count = 0;
while (p != NULL)
{
count++;
}
return count;
}

template
T List::Average()
{
T average = 0;
T sum = 0;
while (p != NULL)
{
sum += (p->data);
}
return average = (sum / Count());
}

template
List::List()
{
//默认构造函数
currPos = NULL;
}

template
List::~List()
{
clear();
}

template
void List::Append(const T value)
{
{
}
else
{
currPos = p;
}
}

template
void List::clear()
{
{
}
}

template
void List::print()
{
while (p != NULL)
{
cout << p->data << " ";
}
cout << endl;
}

template
{
int top = -1;
stacktemp;
while (p != NULL)
{
temp.push(p->data);
}
while (p != NULL)
{
p->data = temp.top();
temp.pop();
}
}

#endif

//主函数
#include"List.h"

int main(int argc, char argv[])
{
Listlist;
int count;
cout << "请输入单链表的长度：";
cin >> count;
int value;
for (int i = 0; i < count; i++)
{
cin >> value;
list.Append(value);
}
/*list.print();
}