cmessagebox.cpp

来自「软件的名称:AA制用餐管理系统 软件的功能:管理消费中产生的费用」· C++ 代码 · 共 88 行

CPP
88
字号
#include "CMessageBox.h"
#include "function.h"
#include <conio.h>
#include <iostream>
using namespace std;

////////////////////////////////////////////////////////////////////
void CMessageBox::ShowMessage(char *message,int x,int y)
{
	int maxsize =40;
	function::SetXY(x,y);
	int i=0;
	int j=0;
	int len =strlen(message);
	while(j<len)	
	{   
		printf("%c",*(message+j));
		j++;
		if(j%maxsize==0)
		{   
			i=1;
			cout<<endl;
			function::SetXY(x,y+i);
		}
	}
}
///////////////////////////////////////////////////////////////////
//打印消息
char CMessageBox::Show(int sign,int x,int y)
{
	char value;
	char choose[2];	
    choose[1]='\0';
	if(sign==1)
	{
		function::SetXY(x,y);
		//char *str="press any key to continue...";
		ShowMessage("press any key to continue...",1,19);
		getch();
		return 0;
	}else if(sign==2)
	{
		while(1)
		{
			choose[0]='\0';
			//function::SetXY(x,y);
			//char *str="Please input Y/N:";
			ShowMessage("Please input Y/N:",x,y);
			function::SetXY(x+20,y);
			function::input(choose,1);
			value=choose[0];
			if(!(value=='Y'|| value=='y' || value=='N' || value=='n'))
			{
                //char *str="Yout inputed id invalid,please input Y/N...press any key to continue";
				ShowMessage("Yout inputed id invalid,please input Y/N...press any key to continue",1,19);
				getch();
				//system("cls");
				function::ClearScreen(1,19,78,21);
				function::ClearScreen(x+20,y,78,y);
			}
			else			
				return value;
		}
	}else if(sign==3)
	{
		while(1)
		{
			choose[0]='\0';
			//function::SetXY(x,y);
			ShowMessage("Please input Y/N/C:",x,y);
			function::SetXY(x+20,y);
			function::input(choose,1);
			value=choose[0];
			if(!(value=='Y'|| value=='y' || value=='N' || value=='n' || value=='C' || value=='c' ))
			{
                //function::SetXY(x,y+1);
				ShowMessage("Yout inputed id invalid,please input Y/N/C...press any key to continue",1,19);
				getch();
				//system("cls");
				function::ClearScreen(1,19,78,21);
				function::ClearScreen(x+20,y,78,y);
			}
			else
				return value;
		}
	}
	return 0;
}

⌨️ 快捷键说明

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