easyx 图形职工管理系统

#include<iostream>
#include<conio.h>//使用_getch()
#include<graphics.h>
#include<Windows.h>
#include<fstream>
#include<stdlib.h>
#include<string>
#include<mmsystem.h>//包含多媒体设备接口头文件,要在图形库头文件下方
#pragma comment(lib,"winmm.lib")//加载静态库
using namespace std;
class administrator //管理员类
{
protected:
	string ID;
	string password;
	administrator* unext;
public:
	string getID();
	void setID(string ID);
	string getpassword();
	void setpassword(string password);
	administrator*& getunext();
};
string administrator::getID()
{
	return ID;
}

void administrator::setID(string ID)
{
	this->ID = ID;
}

void administrator::setpassword(string password)
{
	this->password = password;
}
string administrator::getpassword()
{
	return password;
}
administrator*& administrator::getunext()
{
	return unext;
}
class Employee//定义职工的基类
{
protected:
	string id;//工号
	string name;//姓名
	string sex;//性别
	string degree;//等级
	Employee* next;
public:
	virtual string getid();//返回id
	virtual void setid(string id);//给id赋值
	virtual string getname();//返回name
	virtual void setname(string name);//给name赋值
	virtual string getsex();//返回性别
	virtual void setsex(string sex);//给性别赋值
	virtual string getdegree();//返回职位
	virtual void setdegree(string degree);
	Employee*& getnext();//返回next
};
string Employee::getid()
{
	return id;
}

void Employee::setid(string id)
{
	this->id = id;
}
string Employee::getname()
{
	return name;
}
void Employee::setname(string name)
{
	this->name = name;
}
string Employee::getsex()
{
	return sex;
}
void Employee::setsex(string sex)
{
	this->sex = sex;
}
string Employee::getdegree()
{
	return degree;
}
void Employee::setdegree(string degree)
{
	this->degree = degree;
}
Employee*& Employee::getnext()
{
	return next;
}
class Function :public Employee
{
public:
	Employee* head = new Employee;
public:
	void add();//增
	void change();//改
	void Delete();//删
	void find();//查
	void show();//浏览信息
	void payoff();//查询工资
	void sort();//按照工号排序
	void quit();//退出
	void menu();
};
void Function::add()
{
	cleardevice();//清屏
	IMAGE img; loadimage(&img, "./111.jpg", 800, 800);
	putimage(0, 0, &img);
	settextcolor(GREEN);//设置文字颜色
	settextstyle(50, 0, "楷体");
	outtextxy(190, 92, "职工管理系统");//在窗口里写字
	outtextxy(80, 210, "工号:");
	fillrectangle(200, 215, 500, 270);
	outtextxy(80, 310, "姓名:");
	fillrectangle(200, 315, 500, 370);
	outtextxy(80, 410, "性别:");
	fillrectangle(200, 415, 500, 470);
	outtextxy(80, 510, "职位:");
	fillrectangle(200, 515, 500, 570);
	char s[20];
	InputBox(s, 10, "请输入工号:");
	outtextxy(200, 220, s);
	char m[20];
	InputBox(m, 10, "请输入姓名:");
	outtextxy(200, 320, m);
	char a[20];
	InputBox(a, 10, "请输入性别:");
	outtextxy(200, 420, a);
	char b[20];
	InputBox(b, 10, "请输入职位:");
	outtextxy(200, 520, b);
	//获取窗口句柄
	HWND hnd = GetHWnd();
	//弹出窗口提示用户操作
	int isok = MessageBox(hnd, "录入成功!", "提示", MB_OKCANCEL);
	ofstream fq;
	fq.open("职工信息", ios::app);
	fq << s << " " << m << " " << a << " " << b << endl;
}
void Function::change()
{
	cleardevice();//清屏
	IMAGE img; loadimage(&img, "./111.jpg", 800, 800);
	putimage(0, 0, &img);
	settextcolor(YELLOW);//设置文字颜色
	setbkmode(TRANSPARENT);//把字体设置成透明的
	settextstyle(50, 0, "楷体");
	outtextxy(190, 92, "职工管理系统");//在窗口里写字
	ifstream fp;
	fp.open("职工信息", ios::in);
	Employee* head1 = new Employee;
	Employee* q = head1;
	while (!fp.eof())
	{
		q->getnext() = new Employee;
		q = q->getnext();
		fp >> id >> name >> sex >> degree;
		q->setid(id);
		q->setname(name);
		q->setsex(sex);
		q->setdegree(degree);
	}
	fp.close();
	settextstyle(35, 0, "楷体");
	fillrectangle(250, 160, 470, 200);
	outtextxy(160, 160, "工号:");
	char s[20];
	InputBox(s, 10, "请输入要改动的职工工号:");
	q = head1;
	while (q->getnext() != NULL)
	{
		q = q->getnext();
		if (q->getid() == s)
		{
			settextcolor(GREEN);//设置文字颜色
			fillrectangle(250, 160, 470, 200);
			outtextxy(160, 160, "工号:");
			fillrectangle(250, 220, 470, 260);
			outtextxy(160, 220, "姓名:");
			fillrectangle(250, 280, 470, 320);
			outtextxy(160, 280, "性别:");
			fillrectangle(250, 340, 470, 380);
			outtextxy(160, 340, "职位:");
			//输出信息
			outtextxy(252, 162, q->getid().c_str());
			outtextxy(252, 222, q->getname().c_str());
			outtextxy(252, 282, q->getsex().c_str());
			outtextxy(252, 342, q->getdegree().c_str());
			//获取窗口句柄
			HWND hnd = GetHWnd();
			//弹出窗口提示用户操作
			int isok = MessageBox(hnd, "该职工信息如下!", "提示", MB_OKCANCEL);
			break;
		}
		if (q->getnext() == NULL)
		{
			//获取窗口句柄
			HWND hnd = GetHWnd();
			//弹出窗口提示用户操作
			int isok = MessageBox(hnd, "查无此人!", "提示", MB_OKCANCEL);
			return;
		}
	}
	char p[20];
	InputBox(p, 10, "请输入新的职工工号:");
	char o[20];
	InputBox(o, 10, "请输入新的职工姓名:");
	char i[20];
	InputBox(i, 10, "请输入新的职工性别:");
	char u[20];
	InputBox(u, 10, "请输入新的职工等级:");
	q = head1->getnext();
	while (q != NULL)
	{
		if (q->getid() == s)
		{
			q->setid(p);
			q->setname(o);
			q->setsex(i);
			q->setdegree(u);
			ofstream ff;
			ff.open("职工信息", ios::out);
			Employee* amn = new Employee;
			amn = head1->getnext();
			while (amn != NULL)
			{
				if (amn->getnext() == NULL)
				{
					break;
				}
				ff << amn->getid()<<" " << amn->getname()<<" " << amn->getsex()<<" " << amn->getdegree()<<" " << endl;
				amn = amn->getnext();
			}
			//获取窗口句柄
			HWND hnd = GetHWnd();
			//弹出窗口提示用户操作
			int isok = MessageBox(hnd, "信息修改完毕!", "提示", MB_OKCANCEL);
			return;
		}
		q = q->getnext();
	}
	

}
void Function::Delete()
{
	cleardevice();//清屏
	IMAGE img; loadimage(&img, "./111.jpg", 800, 800);
	putimage(0, 0, &img);
	settextcolor(YELLOW);//设置文字颜色
	setbkmode(TRANSPARENT);//把字体设置成透明的
	settextstyle(50, 0, "楷体");
	outtextxy(190, 92, "职工管理系统");//在窗口里写字
	Employee* head4 = new Employee;
	Employee* q = head4;
	ifstream fp;
	fp.open("职工信息", ios::in);
	while (!fp.eof())
	{
		q->getnext() = new Employee;
		q = q->getnext();
		fp >> id >> name >> sex >> degree;
		q->setid(id);
		q->setname(name);
		q->setsex(sex);
		q->setdegree(degree);
	}
	fp.close();
	Employee* p = head4;
	char s[20];
	InputBox(s, 10, "请输入要删除的职工工号:");
	int flag = 1;
	while (p->getnext() != NULL)
	{
		if (p->getnext()->getid() == s)
		{
			p->getnext() = p->getnext()->getnext();
			flag = 0;
			//获取窗口句柄
			HWND hnd = GetHWnd();
			//弹出窗口提示用户操作
			int isok = MessageBox(hnd, "删除成功!", "提示", MB_OKCANCEL);
			break;
		}
		p = p->getnext();
	}
	if (flag == 1)
	{
		//获取窗口句柄
		HWND hnd = GetHWnd();
		//弹出窗口提示用户操作
		int isok = MessageBox(hnd, "删除失败!", "提示", MB_OKCANCEL);
		return;
	}
	if (flag == 0)
	{
		ofstream fq;
		fq.open("职工信息", ios::out);
		p = head4->getnext();
		while (p->getnext() != NULL)
		{
			fq << p->getid() << " " << p->getname() << " " << p->getsex() << " " << p->getdegree() << endl;
			p = p->getnext();
		}
		fq.close();
	}
}
void Function::find()
{
	cleardevice();//清屏
	IMAGE img; loadimage(&img, "./111.jpg", 800, 800);
	putimage(0, 0, &img);
	settextcolor(YELLOW);//设置文字颜色
	setbkmode(TRANSPARENT);//把字体设置成透明的
	settextstyle(50, 0, "楷体");
	outtextxy(190, 92, "职工管理系统");//在窗口里写字
	ifstream fp;
	fp.open("职工信息", ios::in);
	Employee* q = head;
	while (!fp.eof())
	{
		q->getnext() = new Employee;
		q = q->getnext();
		fp >> id >> name >> sex >> degree;
		q->setid(id);
		q->setname(name);
		q->setsex(sex);
		q->setdegree(degree);
	}
	fp.close();
	settextstyle(35, 0, "楷体");
	fillrectangle(250, 160, 470, 200);
	outtextxy(160, 160, "工号:");
	char s[20];
	InputBox(s, 10, "请输入要查询的职工工号:");
	//outtextxy(162, 162, s);
	q = head;
	while (q ->getnext()!= NULL)
	{
		q = q->getnext();
		if (q->getnext() == NULL)
		{
			return;
		}
		
		if (q->getid() ==  s )
		{
			settextcolor(GREEN);//设置文字颜色
			fillrectangle(250, 160, 470, 200);
			outtextxy(160, 160, "工号:");
			fillrectangle(250, 220, 470, 260);
			outtextxy(160, 220, "姓名:");
			fillrectangle(250, 280, 470, 320);
			outtextxy(160, 280, "性别:");
			fillrectangle(250, 340, 470,380);
			outtextxy(160, 340, "职位:");
			//输出信息
			outtextxy(252, 162, q->getid().c_str());
			outtextxy(252, 222, q->getname().c_str());
			outtextxy(252, 282, q->getsex().c_str());
			outtextxy(252, 342, q->getdegree().c_str());
			//获取窗口句柄
			HWND hnd = GetHWnd();
			//弹出窗口提示用户操作
			int isok = MessageBox(hnd, "该职工信息如下!", "提示", MB_OKCANCEL);
		}
		
		}
	//获取窗口句柄
	HWND hnd = GetHWnd();
	//弹出窗口提示用户操作
	int isok = MessageBox(hnd, "查无此人!", "提示", MB_OKCANCEL);
}
		

void Function::show()
{
	cleardevice();//清屏
	IMAGE img; loadimage(&img, "./111.jpg", 800, 800);
	putimage(0, 0, &img);
	settextcolor(YELLOW);//设置文字颜色
	settextstyle(50, 0, "楷体");
	outtextxy(190, 92, "职工管理系统");//在窗口里写字
	outtextxy(10, 210, "工号:");
	outtextxy(220, 210, "姓名:");
	outtextxy(400, 210, "性别:");
	outtextxy(600, 210, "职位:");
	Employee* head3 = new Employee;
	Employee* q=head3;
	ifstream fp;
	fp.open("职工信息", ios::in);
	while (fp >> id >> name >> sex >> degree)
	{
		q->getnext()= new Employee;
		q = q->getnext();
		q->setid(id);
		q->setname(name);
		q->setsex(sex);
		q->setdegree(degree);
	}
	fp.close();
	string iid;
	string nname;
	string ssex;
	string ddegree;
	Employee* l = new Employee;
	l = head3;
	int m = 250;
	while (l ->getnext()!= NULL)
	{
		l = l->getnext();
		iid = l->getid();
		nname = l->getname();
		ssex = l->getsex();
		ddegree = l->getdegree();
		outtextxy(10, m, iid.c_str());
		outtextxy(220, m,nname.c_str());
		outtextxy(400, m,ssex.c_str() );
		outtextxy(595, m, ddegree.c_str());
		m += 50;
	}
	//获取窗口句柄
	HWND hnd = GetHWnd();
	//弹出窗口提示用户操作
	int isok = MessageBox(hnd, "职工信息已全部显示!", "提示", MB_OKCANCEL);
}
void Function::payoff()
{
	cleardevice();//清屏
	IMAGE img; loadimage(&img, "./111.jpg", 800, 800);
	putimage(0, 0, &img);
	settextcolor(YELLOW);//设置文字颜色
	setbkmode(TRANSPARENT);//把字体设置成透明的
	settextstyle(50, 0, "楷体");
	outtextxy(190, 92, "职工管理系统");//在窗口里写字
	ifstream fp;
	fp.open("职工信息", ios::in);
	Employee* head5 = new Employee;
	Employee* q = head5;
	while (!fp.eof())
	{
		q->getnext() = new Employee;
		q = q->getnext();
		fp >> id >> name >> sex >> degree;
		q->setid(id);
		q->setname(name);
		q->setsex(sex);
		q->setdegree(degree);
	}
	fp.close();
	q = head5->getnext();
	char s[20];
	InputBox(s, 10, "请输入要查询的职工工号:");
	while (q != NULL)
	{
		if (q->getid() == s)
		{
			outtextxy(190, 180, "职工工号:");
			outtextxy(190, 230, "职工姓名:");
			outtextxy(190, 300, "职工性别:");
			outtextxy(190, 370, "职工职位:");

			outtextxy(450, 182, q->getid().c_str());
			outtextxy(450, 232, q->getname().c_str());
			outtextxy(450, 302, q->getsex().c_str());
			outtextxy(450, 372, q->getdegree().c_str());
	
			char h[20];
			InputBox(h, 10, "请输入工作的月数:");
			if (q->getdegree() == "普通职工")
			{
				int H = atoi(h)*2000;
				outtextxy(120, 450, "工资为:");
				outtextxy(320, 450, to_string(H).c_str());
				//获取窗口句柄
				HWND hnd = GetHWnd();
				//弹出窗口提示用户操作
				int isok = MessageBox(hnd, "工资信息如下!", "提示", MB_OKCANCEL);
			}
			else if (q->getdegree() == "销售人员")
			{
				int G = atoi(h) * 3000;
				outtextxy(120, 450, "工资为:");
				outtextxy(320, 450, to_string(G).c_str());
				//获取窗口句柄
				HWND hnd = GetHWnd();
				//弹出窗口提示用户操作
				int isok = MessageBox(hnd, "工资信息如下!", "提示", MB_OKCANCEL);
			}
			else
			{
				int M = atoi(h) * 4000;
				outtextxy(120, 450, "工资为:");
				outtextxy(320, 450, to_string(M).c_str());

				//获取窗口句柄
				HWND hnd = GetHWnd();
				//弹出窗口提示用户操作
				int isok = MessageBox(hnd, "工资信息如下!", "提示", MB_OKCANCEL);
			}
			return;
		}
		q = q->getnext();
	}
	//获取窗口句柄
	HWND hnd = GetHWnd();
	//弹出窗口提示用户操作
	int isok = MessageBox(hnd, "查无此人!", "提示", MB_OKCANCEL);
}
void Function::sort()
{
	cleardevice();//清屏
	IMAGE img; loadimage(&img, "./111.jpg", 800, 800);
	putimage(0, 0, &img);
	settextcolor(YELLOW);//设置文字颜色
	settextstyle(50, 0, "楷体");
	outtextxy(190, 92, "职工管理系统");//在窗口里写字
	outtextxy(10, 210, "工号:");
	outtextxy(220, 210, "姓名:");
	outtextxy(400, 210, "性别:");
	outtextxy(600, 210, "职位:");
	ifstream fp;
	fp.open("职工信息", ios::in);
	Employee* head7 = new Employee;
	Employee* q = head7;
	while (fp >> id >> name >> sex >> degree)
	{
		q->getnext() = new Employee;
		q = q->getnext();
		q->setid(id);
		q->setname(name);
		q->setsex(sex);
		q->setdegree(degree);
	}
	fp.close();
	Employee* f, * p, * x, * y;
	f = NULL;
	while (f != head7->getnext()->getnext())//外层判断少一次循环 
	{
		for (p = head7; p->getnext()->getnext() != f; p = p->getnext())
		{
			if (p->getnext()->getid() > p->getnext()->getnext()->getid())
			{
				x = p->getnext();//x和y首先指向这两个要交换的节点 
				y = p->getnext()->getnext();
				p->getnext() = y;//交换三部曲 
				x->getnext() = y->getnext();
				y->getnext() = x;
			}
		}
		f = p->getnext();//把 f 往前移 
	}
	string iid;
	string nname;
	string ssex;
	string ddegree;
	Employee* l = new Employee;
	l = head7;
	int m = 250;
	while (l->getnext() != NULL)
	{
		l = l->getnext();
		iid = l->getid();
		nname = l->getname();
		ssex = l->getsex();
		ddegree = l->getdegree();
		outtextxy(10, m, iid.c_str());
		outtextxy(220, m, nname.c_str());
		outtextxy(400, m, ssex.c_str());
		outtextxy(595, m, ddegree.c_str());
		m += 50;
	}
	//获取窗口句柄
	HWND hnd = GetHWnd();
	//弹出窗口提示用户操作
	int isok = MessageBox(hnd, "职工信息已全部显示!", "提示", MB_OKCANCEL);
}
void Function::quit()
{
		cleardevice();//清屏
		IMAGE img; loadimage(&img, "./111.jpg", 800, 800);
		putimage(0, 0, &img);
		settextcolor(YELLOW);//设置文字颜色
		settextstyle(50, 0, "楷体");
		outtextxy(190, 92, "职工管理系统");//在窗口里写字
		outtextxy(190, 350, "感谢您的使用再见!");
		//getchar();
		//exit(0);
}
void Function::menu()
{
	while(1)
	{
	//双缓冲绘图,需要放在绘图代码之前和之后
	BeginBatchDraw();
	//设置背景
	IMAGE img; loadimage(&img, "./111.jpg", 800, 800);
	putimage(0, 0, &img);
	setfillcolor(YELLOW);//设置填充颜色
	settextcolor(RGB(0, 255, 13));
	settextstyle(50, 0, "楷体");
	outtextxy(190, 30, "职工管理系统");//在窗口里写字
	//设置按钮
	fillrectangle(200, 90, 500, 130);
	settextcolor(BROWN);//设置文字颜色
	setbkmode(TRANSPARENT);//把字体设置成透明的
	//设置文字样式,大小,字体
	settextstyle(30, 0, "楷体");
	outtextxy(225, 90, "1.录入职工信息");//在窗口里写字
	//设置按钮
	fillrectangle(200, 140, 500, 180);
	outtextxy(225, 143, "2.修改职工信息");//在窗口里写字
	//设置按钮
	fillrectangle(200, 200, 500, 240);//左上角x,左上角y,右下角x,右下角y
	outtextxy(225, 203, "3.删除职工信息");//在窗口里写字
	//设置按钮
	fillrectangle(200, 250, 500, 290);//左上角x,左上角y,右下角x,右下角y
	outtextxy(225, 253, "4.查询职工信息");//在窗口里写字
	//设置按钮
	fillrectangle(200, 310, 500, 350);//左上角x,左上角y,右下角x,右下角y
	outtextxy(225, 313, "5.浏览职工信息");//在窗口里写字
	//设置按钮
	fillrectangle(200, 370, 500, 410);//左上角x,左上角y,右下角x,右下角y
	outtextxy(225, 373, "6.查询工资信息");//在窗口里写字
	//设置按钮
	fillrectangle(200, 430, 500, 470);//左上角x,左上角y,右下角x,右下角y
	outtextxy(225, 433, "7.按照工号排序");//在窗口里写字
	//设置按钮
	fillrectangle(200, 490, 500, 530);//左上角x,左上角y,右下角x,右下角y
	outtextxy(225, 493, "8.退出系统");//在窗口里写字
	EndBatchDraw();
	Function ff;
	//鼠标消息
	
		if (MouseHit())//MouseHit()用来判断是否接受到鼠标消息
		{
			//cleardevice();
			MOUSEMSG msg = GetMouseMsg();
			//消息分发
			switch (msg.uMsg)
			{
			case WM_LBUTTONDOWN:
				if (msg.x > 200 && msg.x < 500 && msg.y>90 && msg.y < 130)
				{
					ff.add();
					break;
				}
				if (msg.x > 200 && msg.x < 500 && msg.y>140 && msg.y < 180)
				{
					ff.change();
					break;
				}
				if (msg.x > 200 && msg.x < 500 && msg.y>200 && msg.y < 240)
				{
					ff.Delete();
					break;
				}
				if (msg.x > 200 && msg.x < 500 && msg.y>250 && msg.y < 290)
				{
					ff.find();
					break;
				}
				if (msg.x > 200 && msg.x < 500 && msg.y>310 && msg.y < 350)
				{
					ff.show();
					break;
				}
				if (msg.x > 200 && msg.x < 500 && msg.y>370 && msg.y < 410)
				{
					ff.payoff();
					break;
				}
				if (msg.x > 200 && msg.x < 500 && msg.y>430 && msg.y < 470)
				{
					ff.sort();
					break;
				}
				if (msg.x > 200 && msg.x < 500 && msg.y>490 && msg.y < 530)
				{
					ff.quit();
					getchar();
					break;
				}
				
			}
		}
	}

}

void denglu()
{
	cleardevice();//清屏
	IMAGE img; loadimage(&img, "./111.jpg", 800, 800);
	putimage(0, 0, &img);
	settextcolor(GREEN);//设置文字颜色
	settextstyle(50, 0, "楷体");
	outtextxy(190, 92, "职工管理系统");//在窗口里写字
	outtextxy(80, 210, "账号:");
	fillrectangle(200, 215, 500, 270);
	outtextxy(80, 310, "密码:");
	fillrectangle(200, 315, 500, 370);
	fillrectangle(200, 415, 500, 470);
	outtextxy(310, 415, "登录");
	char s[20];
	InputBox(s, 10, "请输入账号:");
	outtextxy(200, 220, s);
	char m[20];
	InputBox(m, 10, "请输入密码:");
	outtextxy(200, 320, m);
	Function f;
	ifstream fp;
	fp.open("管理员信息", ios::in);
	string IID;
	string ppassword;
	administrator* head9 = new administrator;
	administrator* p = new administrator;
	p = head9;
	while (fp >> IID >> ppassword)
	{
		p->getunext() = new administrator;
		p = p->getunext();
		p->setID(IID);
		p->setpassword(ppassword);
	}
	fp.close();
	int flag = 1;
	//鼠标消息
	while (1)
	{
		if (MouseHit())//MouseHit()用来判断是否接受到鼠标消息
		{
			//cleardevice();
			MOUSEMSG msg = GetMouseMsg();
			//消息分发
			switch (msg.uMsg)
			{
			case WM_LBUTTONDOWN:
				if (msg.x > 200 && msg.x < 500 && msg.y>415 && msg.y < 470)
				{
					p = head9 ->getunext();
					while (p!= NULL)
					{
						
						if (p->getID() == s && p->getpassword() == m)
						{
							//获取窗口句柄
							HWND hnd = GetHWnd();
							//弹出窗口提示用户操作
							int isok = MessageBox(hnd, "登录成功!", "提示", MB_OKCANCEL);
							cleardevice();
							flag = 0;
							f.menu();

						}
						p = p->getunext();
					}	
					if (flag == 1)
					{
						//获取窗口句柄
						HWND hnd = GetHWnd();
						//弹出窗口提示用户操作
						int isok = MessageBox(hnd, "账号或密码错误!", "提示", MB_OKCANCEL);
						InputBox(s, 10, "请输入账号:");
						fillrectangle(200, 215, 500, 270);
						outtextxy(200, 220, s);
						InputBox(m, 10, "请输入密码:");
						fillrectangle(200, 315, 500, 370);
						outtextxy(200, 320, m);
					}
				}
				break;
			}
		}

	}
	
}
void reg()
{
	cleardevice();//清屏
	IMAGE img; loadimage(&img, "./111.jpg", 800, 800);
	putimage(0, 0, &img);
	settextcolor(GREEN);//设置文字颜色
	settextstyle(50, 0, "楷体");
	outtextxy(190, 92, "职工管理系统");//在窗口里写字
	outtextxy(5, 210, "注册账号:");
	fillrectangle(200, 215, 500, 270);
	outtextxy(5, 310, "注册密码:");
	fillrectangle(200, 315, 500, 370);
	char s[20];
	InputBox(s, 10, "注册账号:");
	outtextxy(200, 220, s);
	char m[20];
	InputBox(m, 10, "注册密码:");
	outtextxy(200, 320, m);
	ofstream fp;
	fp.open("管理员信息", ios::app);
	fp << s << " " << m << endl;
	//获取窗口句柄
	HWND hnd = GetHWnd();
	//设置窗口标题
	//SetWindowText(hnd, "职工管理系统");
	//弹出窗口提示用户操作
	int isok = MessageBox(hnd, "注册成功!", "提示", MB_OKCANCEL);
}

int main()
{
	initgraph(800, 700, SHOWCONSOLE);//设置界面窗口
	//设置背景
	IMAGE img; loadimage(&img, "./111.jpg", 800, 800);
	putimage(0, 0, &img);
	setfillcolor(YELLOW);//设置填充颜色
	settextcolor(RGB(0, 255, 13));
	settextstyle(50, 0, "楷体");
	outtextxy(190, 92, "职工管理系统");//在窗口里写字
	//设置按钮
	fillrectangle(200,215,500,270);
	settextcolor(BROWN);//设置文字颜色
	setbkmode(TRANSPARENT);//把字体设置成透明的
	//设置文字样式,大小,字体
	settextstyle(30, 0, "楷体");
	outtextxy(300, 220, "登录");//在窗口里写字
	//设置按钮
	fillrectangle(200, 315, 500, 370);
	outtextxy(300, 330, "注册");//在窗口里写字
	//设置按钮
	fillrectangle(200, 415, 500, 470);//左上角x,左上角y,右下角x,右下角y
	outtextxy(300, 435, "退出");//在窗口里写字
	mciSendString("open 333.mp3 alias music", 0, 0, 0);
	mciSendString("play music", 0, 0, 0);
	Function f1;

	//鼠标消息
	while (1)
	{
		if (MouseHit())//MouseHit()用来判断是否接受到鼠标消息
		{
			//cleardevice();
			MOUSEMSG msg = GetMouseMsg();
			//消息分发
			switch (msg.uMsg)
			{
			case WM_LBUTTONDOWN:
				if (msg.x > 200 && msg.x < 500 && msg.y>215 && msg.y < 270)
				{
					denglu();
				}
				if (msg.x > 200 && msg.x < 500 && msg.y>315 && msg.y < 370)
				{
					reg();
					cleardevice();
					//设置背景
					IMAGE img; loadimage(&img, "./111.jpg", 800, 800);
					putimage(0, 0, &img);
					setfillcolor(YELLOW);//设置填充颜色
					settextcolor(RGB(0, 255, 13));
					settextstyle(50, 0, "楷体");
					outtextxy(190, 92, "职工管理系统");//在窗口里写字
					//设置按钮
					fillrectangle(200, 215, 500, 270);
					settextcolor(BROWN);//设置文字颜色
					setbkmode(TRANSPARENT);//把字体设置成透明的
					//设置文字样式,大小,字体
					settextstyle(30, 0, "楷体");
					outtextxy(300, 220, "登录");//在窗口里写字
					//设置按钮
					fillrectangle(200, 315, 500, 370);
					outtextxy(300, 330, "注册");//在窗口里写字
					//设置按钮
					fillrectangle(200, 415, 500, 470);//左上角x,左上角y,右下角x,右下角y
					outtextxy(300, 435, "退出");//在窗口里写字
				}
				if (msg.x > 200 && msg.x < 500 && msg.y>415 && msg.y < 470)
				{
					f1.quit();
				}

				break;
			case WM_RBUTTONDOWN:
				break;
			}
		}
	}

	getchar();
	//关闭窗口
	closegraph();
	return 0;
}



  • 7
    点赞
  • 36
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值