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

📄 errormessage.cpp

📁 软件的名称:AA制用餐管理系统 软件的功能:管理消费中产生的费用
💻 CPP
字号:
//////////////////////////////////////
#include <conio.h>
#include <iostream>
#include <cstring>
using namespace std;
#include "ErrorMessage.h"
#include "function.h"

//////////////////////////////////////
void ErrorMessage::ShowMessage(string &str,int x,int y)
{
	int j=0;
	int maxsize =70;
	function::SetXY(x,y);
	int len=str.length();
	for(int i=0;i<len;i++)
	{
		cout<<str.at(i);
		if((i+1)%maxsize==0)
		{
			j++;
			cout<<endl;
			function::SetXY(x,y+j);
		}
	}
}
//////////////////////////////////////

void ErrorMessage::LengthErr(int x,int y,int geti)
{
	if(!geti)
		return;
	string err[]={"Input cannot be null!...Press any key to continue",
		          "Input length is over!...Press any key to continue"};
	//function::SetXY(x,y);
	ShowMessage(err[geti-1], x, y);
	getch();
	return;
}
//////////////////////////////////////
 void  ErrorMessage::LettreOrSpaceErr(int x,int y,int geti)
{
	if(!geti)
		return;
	string err[] ={"Input cannot be null!...Press any key to continue",
		          "Input length must be digit or blank!...Press any key to continue"};
	ShowMessage(err[geti-1], x, y);
	getch();
	return;
}
/////////////////////////////////////
void ErrorMessage::SexErr(int x,int y,int geti)
{
	if(!geti)
		return;
	string err[] ={"Input cannot be null!...Press any key to continue",
		          "Input length must be M or F!...Press any key to continue"};
	ShowMessage(err[geti-1], x, y);
	getch();
	return;
}
/////////////////////////////////////
void ErrorMessage::DateRangleErr(int x,int y,int geti)
{
	if(!geti)
		return;
	string err[]={ "Input exceeds!...Press any key to continue"};
	ShowMessage(err[geti-1],x,y);
	getch();
	return;
}
/////////////////////////////////////
void ErrorMessage::DateStringErr(int x,int y,int geti)
{
	if(!geti)
		return;
	string err[]={"Input cannot be null!...Press any key to continue",
		          "Input length is more than requestded!...Press any key to continue",
				  "Input format is error!...Press any key to continue",
				  "year,month or day must be digit(0-9)!...Press any key to contiue",
				  "month must be between 1 and 12!...Press any key to continue",
				  " day must meet with month!...Press any key to continue "};
	ShowMessage(err[geti-1],x,y);
	getch();
	return;
}
////////////////////////////////////
void ErrorMessage::MobileErr(int x,int y,int geti)
{
	if(!geti)
		return;
	string err[] ={
                   "MobileTel length must be 11 or 12!...Press any key to continue",
				   "MobileTel number must be digit(0-9)!...Press any key to continue",
				   "Since MobileTel length is equal to 12,please be sure MobileTel begin with 0!...Press any key to continue"};
	ShowMessage(err[geti-1],x,y);
	getch();
	return;
}
///////////////////////////////////
void ErrorMessage::DataRangleErr(int x,int y,int geti)
{
	if(!geti)
		return;
	string err[] ={"Input data not in given scope!...Press any key to continue"};
	ShowMessage(err[geti-1],x,y);
	getch();
	return;
}
/////////////////////////////////////
void ErrorMessage::SelectErr(int x,int y,int geti)
{
	if(!geti)
		return;
	string err[]={"Input cannot be null!...Press any key to continue",
				  "Input contains invalid character!...Press any key to continue",
				  "Input not in given scope!...Press any key to continue"};
	ShowMessage(err[geti-1],x,y);
	getch();
	return;
}
///////////////////////////////////////


⌨️ 快捷键说明

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