?? errormessage.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 + -