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

📄 wateruser.cpp

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

#include "stdafx.h"
#include "atm.h"
#include "WaterUser.h"

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

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

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

WaterUser::~WaterUser()
{
}

ostream& operator <<(ostream & out ,WaterUser &phu)
{
				out<<phu.Getwaterno()<<" "<<phu.Getcost()<<" "<<endl;
				return out;
}
WaterUser* WaterUser::searchwateruser(CString waterno)
{
				WaterUser  *pc=pFirstP;
				if(pc==NULL)
				{
					
					return NULL;
				}
				
				for (;pc;pc=pc->pNextP)
				{
					if (pc->Getwaterno()==waterno)
					{
						
						return pc;
					}
					
				}
				return NULL;
}

bool WaterUser::storageP()
{
	ofstream out("水费用户.txt");
	if(pFirstP==NULL)
						  return 1;
	
	
	WaterUser  *pc=pFirstP;		
	
	for (;pc;pc=pc->pNextP)
	{
								out << *pc ;
								
	}
	out.close();
	return true;
}

/*
// 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
	  //////////////////////////////////////////////////////////////////////
	  
						  
*/

⌨️ 快捷键说明

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