⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gasuser.cpp

📁 一个模仿ATM提款机的MFC程序
💻 CPP
字号:
// Phoneuser.cpp: implementation of the CPhoneuser class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ATM.h"
#include "GasUser.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CGasuser *CGasuser::pFirstP=NULL;		//链表为空
CGasuser::CGasuser(CString phno,double co)
{
	gasno=phno;
	cost=co;
	
	if(pFirstP==NULL)
		pFirstP=this;				//空链表中建立一新帐户
	else
	{
		CGasuser *ps=pFirstP;
		for (;ps->pNextP;ps=ps->pNextP);
		ps->pNextP=this;			//在最后插入本节点
		
	}
	pNextP=NULL;
}

CGasuser::~CGasuser()
{
}

ostream& operator <<(ostream & out ,CGasuser &phu)
{
	out<<phu.Getgasno()<<" "<<phu.Getcost()<<" "<<endl;
	return out;
}
CGasuser* CGasuser::searchgasuser(CString gasno)
{
	CGasuser  *pc=pFirstP;
	if(pc==NULL)
	{
		
		return NULL;
	}
	
	for (;pc;pc=pc->pNextP)
	{
		if (pc->Getgasno()==gasno)
		{
			
			return pc;
		}
		
	}
	return NULL;
}

bool CGasuser::storageP()		//记录链表
{
	ofstream out("煤气用户.txt");
	if(pFirstP==NULL)
		return 1;
	
	
	CGasuser  *pc=pFirstP;		
	
				for (;pc;pc=pc->pNextP)
				{
					out << *pc ;
					
				}
				out.close();
				return true;
}

⌨️ 快捷键说明

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