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

📄 cbroweaccframe.cpp

📁 AA制消费管理系统 要深入学习C++面向对象编程的同学可以看看。
💻 CPP
字号:
#include "CBroweAccFrame.h"
#include "CAccManager.h"
#include "check_char.h"
//#include "check_empty.h"
#include "data_cmp.h"
#include "CPrintMessage.h"
#include "interface.h"
#include <iostream>
#include "check_empty.h"
#include "check_int.h"
#include "CDelSpace.h"
#pragma warning(disable:4700)
#include "CAddBalance.h"
#include <iomanip>
#include <conio.h>
// #include <windows.h>


extern CAccManager acc_admin;





void CBroweAccFrame::printBroweAcc()
{
	int num,accId;
	CAddBalance caddbalance;
	do{
	
	
	string str1[3]={"----------Menu List----------","1.search account by id ","0.return to mainmenu"};
	system("cls");
	printTitle("Browse Account Info");
	
	if ( printVeAcc()==false )
	{
		return;
	}
	
	cout<<endl;
 	printOption(str1,3);
	}while(!(num=inputCtrl(1)));
	switch(num)
	{
	case 2:
		while(!(accId=searchId()));
		
		caddbalance.printAddBalanceFrame(accId);
		
		

	case 1:

	default:
		break;

	}
	
}

/////////////////////////////////////////////////////
void CBroweAccFrame::printAccInfo(int id,string name,double balance)

{
	long f;
	cout.unsetf(f);
	cout<<setw(23)<<id<<"    "<<setw(23)<<setiosflags(ios::left)<<name<<setw(9)<<setiosflags(ios::right)<<fixed<<setprecision(2)<<balance<<endl;
	
}

bool CBroweAccFrame::printVeAcc()
{
	printLine("Account Info");
	string strstyle[3]={"======================================","Id    Name                     Balance","======================================"};
	printOption(strstyle,3);
	int n = acc_admin.getCount();
	if(!(n==0))
	{
		for(int i=1;i<=n;i++)
		{
			if( acc_admin.getVeAcc(i).GetAccFlags()==true         )
			{
							
				printAccInfo(acc_admin.getVeAcc(i).GetId(),acc_admin.getVeAcc(i).GetName(),acc_admin.getVeAcc(i).GetBalance());	
			}
		}

	}
	else
	{
 		cout<<"                     sorry,there is no record!";
		system("pause");
		return false;
 	}
	return true;

}
/////////////////////////////////////////////////////
int CBroweAccFrame::inputCtrl(int n)
{
	cout<<"                         please make a choice 0-"<<n<<":";
	char ch_input=getche();
	

	if(!(C_check_char::checkChar(ch_input)==1))
	{
		CPrintMessage::printMessage(C_check_char::checkChar(ch_input));
		system("pause");
		return 0;
		
		
	}
	else
	{
		if(!(C_check_cmp::check_char(ch_input,n)==1))
		{
			CPrintMessage::printMessage(C_check_cmp::check_char(ch_input,n));
			system("pause");
			return 0;
			

		}
		else
		{
			if(ch_input=='0')
			{
				return 1;
			}
			if(ch_input=='1')
			{
				return 2;
			}

		}
	}

return -1;

}
/////////////////////////////////////////////////////
int CBroweAccFrame::searchId()
{
	cout<<endl<<"                         please enter the id you want:";
	string str_int;
	char str_temp[1024];
	cin.get(str_temp,1024);
	cin.clear();
	cin.ignore(1024,'\n');
	str_int=str_temp;
	if(!(Cchcek_empty::check_empty(str_int)==1))
	{
		CPrintMessage::printMessage(Cchcek_empty::check_empty(str_int));
		system("pause");
		return 0;
	}
	else
	{
				
		if(!(C_check_int::check_int(str_int)==1))
		{
			CPrintMessage::printMessage(C_check_int::check_int(str_int));
			system("pause");
			return 0;
			
						
		}
		else
		{
		
			CDelSpace::delSpace(str_int);
			if(!(C_check_cmp::check_Id(str_int)==1))
			{
				CPrintMessage::printMessage(C_check_cmp::check_Id(str_int));
				system("pause");
				return 0;
				
			}
			else
			{
				return atoi(str_int.c_str());
 			}
		}

	}				
				
				
}

⌨️ 快捷键说明

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