list.cpp

来自「数据结构的一些简单算法」· C++ 代码 · 共 38 行

CPP
38
字号
//===========================================================================
//                               list.cpp
//===========================================================================


#include "list.h"
//list<moNode> *mList ;
list<moNode> & Input()
{
	//construct new list
	moNode* new_moNode;
	new_moNode = new moNode;
	list<moNode> mulist(*new_moNode);

	float TemCoef;
	int   TemExp ;
	while(cin>>TemCoef>>TemExp)
	{
		if(TemCoef == 0) break;
		moNode* new_moNode;
		new_moNode = new moNode(TemCoef,TemExp);
		int position; 
		bool SamExp  ;
		SamExp = mulist.ser_position(*new_moNode,position);
		if(SamExp)
		{
			cout<< mulist.add(position,*new_moNode) <<endl ;
		}
		else
		{
			cout<< mulist.insert(position,*new_moNode) << endl ;
		}
	}
	mulist.output();
//	mList = new list<moNode> (mulist);
	return mulist ;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?