0:在该系统中需要学习基础的c语言语法,以及C语言的文件输入和输出,学习链表的操作。需要源码的和如何配置插件的后台私信。
1:通过easyx插件进行编写——引入头文件
#include<easyx.h>
#include<stdio.h>
#include<iostream>
声名我是通过dev进行编写所以需要在dev上进行配置——可以看其他博主的教学配置。
注意:如果配置好以后没有设置模板,就需要每次输入这串代码:-leasyx -lgdi32 -lole32
2:接下来就展现效果
2.1:这是用户界面
2.2:管理员界面
3:接下来就展现部分代码,需要源码直接发私信。
3.1:用户功能的相关代码
//该位置应该重写,放入用户使用循环中
SLtour User_Interface(SLtour stuhead) //用户接口
{
SLtour head = stuhead;
char input[20];
int n;
// HWND hwnd1 = GetHWnd();
HWND hwnd1 = initgraph(width, height);//获取窗口句柄
SetWindowText(hwnd1, "登录界面");
MoveWindow(hwnd1, 250, 40, width, height, true);//移动窗口
setbkcolor(WHITE);
cleardevice();
//SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) - WS_CAPTION);//去掉边框
IMAGE login;
loadimage(&login, "./face3.jpg", width, height);
putimage(0, 0, &login);
char tip[9]="退出成功";
do {
User_menu();
//printf("请输入你的选择:\n");
//scanf("%d", &input);
InputBox(input, 20, "请输入你的选择", "提示", NULL, 60, 60);
std::stringstream ss(input);//将字符串转为数字
ss >> n;
cout << "用户和管理员的n=" << n << endl;
switch (n)
{
case 1:
Keyword_search(head);
break;
case 2:
seek_list(head); //通过景点名字查找
break;
case 3:
seek_province(head); //通过省份查找
break;
//case 4:
// User_review(head); //用户对于该景点的评语和评分
// break;
//case 4:
// system("cls");
// break;
case 0:
//printf("退出\n");
// HWND hwnd1 = GetHWnd();
// MessageBox(hwnd1, "退出成功", "提示", MB_OK);
outtextxy(width/2-100, height/2, tip);
break;
default:
//printf("请重新正确输入\n");
// HWND hwnd1 = GetHWnd();
MessageBox(hwnd1, "请重新正确输", "提示", MB_OK);
break;
}
} while (n != 0);
return stuhead;
}
3.2:管理员功能相关代码。
//该位置应该重写,放入管理员使用循环中
SLtour Administrator_Interface(SLtour stuhead) //管理员接口
{
SLtour head = stuhead;
char input[20];
int n;
//HWND hwnd1 = GetHWnd();
HWND hwnd1 = initgraph(width, height);//获取窗口句柄
SetWindowText(hwnd1, "登录界面");
MoveWindow(hwnd1, 250, 40, width, height, true);//移动窗口
setbkcolor(WHITE);
cleardevice();
//SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) - WS_CAPTION);//去掉边框
IMAGE login;
loadimage(&login, "./face2.jpg", width, height);
putimage(0, 0, &login);
do {
Administrator_menu();
//printf("请输入你的选择:\n");
//scanf("%d", &input);
InputBox(input, 20, "请输入你的选择", "提示", NULL, 60, 60);
std::stringstream ss(input);//将字符串转为数字
ss >> n;
cout << "用户和管理员的n=" << n << endl;
switch (n)
{
case 1:
head = Administration_insert_data(head);
break;
case 2:
head = Administration_delete_data(head);
break;
case 3:
print_list(head);
break;
case 4:
seek_list(head);
break;
case 5:
head = Duplicate_check(head);
break;
//case 6:
// system("cls");
// break;
case 0:
//printf("退出成功\n");
//HWND hwnd1 = GetHWnd();
MessageBox(hwnd1, "退出成功", "提示", MB_OK);
break;
default:
//printf("请重新输入\n");
//HWND hwnd1 = GetHWnd();
MessageBox(hwnd1, "请重新正确输", "提示", MB_OK);
break;
}
} while (n != 0);
return head;
}
4:管理员和用户功能整合的相关部分代码。
//显示登录的输入框
int passwordInput()
{
SLtour head = NULL;
head = List_And_File_cat(head);
char judgeinput[50], password[] = "123456", input[50], judge1[] = "1", judge2[] = "2",judge0[]="0";
// HWND hwnd1 = GetHWnd();
HWND hwnd1 = initgraph(width, height);//获取窗口句柄
SetWindowText(hwnd1, "登录界面");
MoveWindow(hwnd1, 250, 40, width, height, true);//移动窗口
setbkcolor(WHITE);
cleardevice();
//SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) - WS_CAPTION);//去掉边框
IMAGE login;
loadimage(&login, "./face1.jpg", width, height);
putimage(0, 0, &login);
while (1)
{ //弹出输入框判断是用户还是管理员
InputBox(judgeinput, 50, "用户输入:1\n管理员输入:2\n退出输入:0", "登录", NULL, 60, 60, false);
if (strcmp(judgeinput, judge1) == 0)
{
//return 0;这里放用户操作界面
head = User_Interface(head);
}
else if(strcmp(judgeinput, judge0) == 0)
{
MessageBox(hwnd1, "退出程序", "提示", MB_OK);
break;
}
else//管理员
{
if (strcmp(judgeinput, judge2) == 0)
{
while (1)
{
if (InputBox(input, 50, "请输入密码", "登录", NULL, 60, 60, false) == false)
{
}
else
{
if (strcmp(input, password) == 0)
{
//break;这里放管理员操作界面
head = Administrator_Interface(head);
}
else
{
MessageBox(hwnd1, "输入密码错误,请重新输入", "提示", MB_OK);
if(strcmp(input, password) != 0)
{
break;
}
}
}
}
}
else
{
MessageBox(hwnd1, "输入错误,请重新输入", "提示", MB_OK);
}
}
}
return 0;
}