图形化之家谱遗传系统

news2024/10/5 13:34:48

 1:废话不多说先看成果。

QQ录屏20230418163603

QQ录屏20230418163732

2:解析:

 1:不知道会有多少个孩子,所以我们用二叉树的孩子兄弟结构

typedef struct treeNode {
    char name[100];//名字
    int generation;//辈分
    char gender;//性别
    char birth[11];//生日
    char death[11];//死亡
    struct treeNode* firstChild;//第一个孩子
    struct treeNode* nextSibling;//兄弟
} TreeNode, * Tree;

 2:创立新节点

Tree createNode(char* name, int generation, char gender, char* birth, char* death) {// 创建一个新节点
    Tree node = (Tree)malloc(sizeof(TreeNode));
    strcpy(node->name, name);
    node->generation = generation;
    node->gender = gender;
    strcpy(node->birth, birth);
    strcpy(node->death, death);
    node->firstChild = NULL;
    node->nextSibling = NULL;
    return node;
}

3:因为我没加父亲指针,所以这里又加了一个确立父子关系的函数

void insertChild(Tree parent, Tree child) {//确定父子关系
    if (parent == NULL || child == NULL) {
        return;
    }
    if (parent->firstChild == NULL) { // 如果该节点没有子节点,则直接将新节点作为子节点
        parent->firstChild = child;
    }
    else { // 否则在子节点链表尾部添加新节点
        Tree sibling = parent->firstChild;
        while (sibling->nextSibling != NULL) {
            sibling = sibling->nextSibling;
        }
        sibling->nextSibling = child;
    }
}

4:先序遍历显示整个家谱

void traverseTree(Tree root) {//全部输出
    char a[100];
    if (root == NULL) {
        return;
    }
    if (root->generation == 1)
    {
        strcpy(a, root->name);
        settextcolor(YELLOW);
        settextstyle(25, 0, _T("楷体"));
        outtextxy(130, i, a); i += 100;
    }
    else if (root->generation == 2)
    {
        strcpy(a, root->name);
        settextcolor(YELLOW);
        settextstyle(25, 0, _T("楷体"));
        outtextxy(260, j, a); j += 100;
    }
    else if (root->generation == 3)
    {
        strcpy(a, root->name);
        settextcolor(YELLOW);
        settextstyle(25, 0, _T("楷体"));
        outtextxy(390, o, a); o += 100;
    }
    else if (root->generation == 4)
    {
        strcpy(a, root->name);
        settextcolor(YELLOW);
        settextstyle(25, 0, _T("楷体"));
        outtextxy(510, u, a); u += 100;
    }
    else if (root->generation == 5)
    {
        strcpy(a, root->name);
        settextcolor(YELLOW);
        settextstyle(25, 0, _T("楷体"));
        outtextxy(640, y, a); y += 100;
    }
    else if (root->generation == 6)
    {
        strcpy(a, root->name);
        settextcolor(YELLOW);
        settextstyle(25, 0, _T("楷体"));
        outtextxy(770, t, a); t += 100;
    }
    else if (root->generation == 7)
    {
        strcpy(a, root->name);
        settextcolor(YELLOW);
        settextstyle(25, 0, _T("楷体"));
        outtextxy(900, r, a); r += 100;
    }
    traverseTree(root->firstChild);
    traverseTree(root->nextSibling);
}

5:因为没加父亲指针,又要想想怎么找父亲的节点

Tree findParent(Tree root, Tree p) {//找父亲节点
    if (root == NULL || p == NULL) {
        return NULL;
    }
    if (root == p) {  // 如果要查找的是根节点,则其没有父亲节点
        return NULL;
    }
    Tree q = root->firstChild;
    while (q != NULL) {
        Tree parent = findParent(q, p);  // 递归查找节点p的父亲节点
        if (parent != NULL) {
            return parent;
        }
        q = q->nextSibling;  // 遍历root的下一个兄弟节点
    }
    // 如果root的孩子节点中没有包含节点p,则判断root是否为p的父亲节点
    if (root->firstChild == p) {
        return root;
    }
    else {
        Tree sibling = root->firstChild;
        while (sibling != NULL && sibling != p) {
            sibling = sibling->nextSibling;
        }
        if (sibling != NULL) {
            return root;
        }
    }
    return NULL;  // 没有找到节点p,返回NULL
}

6:有了父亲节点就可以进行删除了

void deleteMember(Tree root) {//删除成员
    char name[100];
    InputBox(name, 100, "请输入要删除的成员姓名:");
    Tree node = searchNode(root, name);
    if (node == NULL) {
        settextcolor(YELLOW);
        settextstyle(50, 0, _T("楷体"));
        outtextxy(690, 200, "没找到");
        return;
    }
    // 删除该节点及其所有子节点
    if (node == root) { // 如果要删除的是根节点,则直接释放整个家谱
        free(root);
        settextcolor(YELLOW);
        settextstyle(50, 0, _T("楷体"));
        outtextxy(690, 200, "家谱已经清空");
        return;
    }
    Tree parent = findParent(root, node);
    Tree child = parent->firstChild;
    while (child != NULL) { // 在父节点的子节点链表中删除该节点
        if (child == node) { // 找到要删除的节点
            if (child == parent->firstChild) { // 如果要删除的节点是第一个子节点,则直接将其后面的节点作为父节点的第一个子节点
                parent->firstChild = child->nextSibling;
            }
            else { // 否则在子节点链表中删除该节点
                Tree sibling = parent->firstChild;
                while (sibling->nextSibling != child) {
                    sibling = sibling->nextSibling;
                }
                sibling->nextSibling = child->nextSibling;
            }
            free(node); // 释放要删除的节点
            settextcolor(YELLOW);
            settextstyle(25, 0, _T("楷体"));
            outtextxy(690, 200, "删除成功");
            return;
        }
        child = child->nextSibling;
    }
}

7:修改和添加的话,就先找到它的节点,加和改。我们直接看完整代码。这里我图形化用的有点乱,抱歉。

3:完整代码

#include <iostream>
#include <stdlib.h>
#include <string.h>
#include<fstream>
#include<easyx.h>
#include<conio.h>
#include<graphics.h>
using namespace std;
const int i1 = 50;
int i = i1, j = i1, o = i1, u = i1, y = i1, t = i1, r = i1, k = i1;
typedef struct treeNode {
    char name[100];//名字
    int generation;//辈分
    char gender;//性别
    char birth[11];//生日
    char death[11];//死亡
    struct treeNode* firstChild;//第一个孩子
    struct treeNode* nextSibling;//兄弟
} TreeNode, * Tree;
void huanyuan()//图形化输出家谱的时候用还原y的坐标
{
    i = i1; j = i1; o = i1; u = i1; y = i1; t = i1; r = i1; k = i1;
}
Tree createNode(char* name, int generation, char gender, char* birth, char* death) {// 创建一个新节点
    Tree node = (Tree)malloc(sizeof(TreeNode));
    strcpy(node->name, name);
    node->generation = generation;
    node->gender = gender;
    strcpy(node->birth, birth);
    strcpy(node->death, death);
    node->firstChild = NULL;
    node->nextSibling = NULL;
    return node;
}
void insertChild(Tree parent, Tree child) {//确定父子关系
    if (parent == NULL || child == NULL) {
        return;
    }
    if (parent->firstChild == NULL) { // 如果该节点没有子节点,则直接将新节点作为子节点
        parent->firstChild = child;
    }
    else { // 否则在子节点链表尾部添加新节点
        Tree sibling = parent->firstChild;
        while (sibling->nextSibling != NULL) {
            sibling = sibling->nextSibling;
        }
        sibling->nextSibling = child;
    }
}
void beifen(Tree root, int a)//辈分输出
{
    char nm[100];
    if (root == NULL)
    {
        return;
    }
    if (root->generation == a)
    {
        strcpy(nm,root->name);
        settextcolor(YELLOW);
        settextstyle(25, 0, _T("楷体"));
        outtextxy(500, k, nm); k += 50;
    }
    beifen(root->firstChild, a);
    beifen(root->nextSibling, a);
}
void traverseTree(Tree root) {//全部输出
    char a[100];
    if (root == NULL) {
        return;
    }
    if (root->generation == 1)
    {
        strcpy(a, root->name);
        settextcolor(YELLOW);
        settextstyle(25, 0, _T("楷体"));
        outtextxy(130, i, a); i += 100;
    }
    else if (root->generation == 2)
    {
        strcpy(a, root->name);
        settextcolor(YELLOW);
        settextstyle(25, 0, _T("楷体"));
        outtextxy(260, j, a); j += 100;
    }
    else if (root->generation == 3)
    {
        strcpy(a, root->name);
        settextcolor(YELLOW);
        settextstyle(25, 0, _T("楷体"));
        outtextxy(390, o, a); o += 100;
    }
    else if (root->generation == 4)
    {
        strcpy(a, root->name);
        settextcolor(YELLOW);
        settextstyle(25, 0, _T("楷体"));
        outtextxy(510, u, a); u += 100;
    }
    else if (root->generation == 5)
    {
        strcpy(a, root->name);
        settextcolor(YELLOW);
        settextstyle(25, 0, _T("楷体"));
        outtextxy(640, y, a); y += 100;
    }
    else if (root->generation == 6)
    {
        strcpy(a, root->name);
        settextcolor(YELLOW);
        settextstyle(25, 0, _T("楷体"));
        outtextxy(770, t, a); t += 100;
    }
    else if (root->generation == 7)
    {
        strcpy(a, root->name);
        settextcolor(YELLOW);
        settextstyle(25, 0, _T("楷体"));
        outtextxy(900, r, a); r += 100;
    }
    traverseTree(root->firstChild);
    traverseTree(root->nextSibling);
}
Tree searchNode(Tree root, char* name) {//查找姓名的节点
    if (root == NULL) {
        return NULL;
    }
    if (strcmp(root->name, name) == 0) {
        return root; // 如果找到了,则返回该节点
    }
    // 否则递归查找该节点的子节点
    Tree child = root->firstChild;
    while (child != NULL) {
        Tree node = searchNode(child, name);
        if (node != NULL) {
            return node;
        }
        child = child->nextSibling;
    }
    return NULL; 
}
void chazhao(Tree root, char* name)//查姓名
{
    int a;
    Tree node=searchNode(root, name);
    if (node == NULL)
    {
        settextcolor(YELLOW);
        settextstyle(50, 0, _T("楷体"));
        outtextxy(690, 200, "没查到");
        return;
    }
    a = node->generation;
    char str[10];
    sprintf(str, "%d", a);
    settextcolor(YELLOW);
    settextstyle(25, 0, _T("楷体"));
    outtextxy(690, 200, node->name);
    outtextxy(690, 250, str);
    outtextxy(690, 400, node->gender);
    outtextxy(690, 300, node->birth);
    outtextxy(690, 350, node->death);
}
Tree findParent(Tree root, Tree p) {//找父亲节点
    if (root == NULL || p == NULL) {
        return NULL;
    }
    if (root == p) {  // 如果要查找的是根节点,则其没有父亲节点
        return NULL;
    }
    Tree q = root->firstChild;
    while (q != NULL) {
        Tree parent = findParent(q, p);  // 递归查找节点p的父亲节点
        if (parent != NULL) {
            return parent;
        }
        q = q->nextSibling;  // 遍历root的下一个兄弟节点
    }
    // 如果root的孩子节点中没有包含节点p,则判断root是否为p的父亲节点
    if (root->firstChild == p) {
        return root;
    }
    else {
        Tree sibling = root->firstChild;
        while (sibling != NULL && sibling != p) {
            sibling = sibling->nextSibling;
        }
        if (sibling != NULL) {
            return root;
        }
    }
    return NULL;  // 没有找到节点p,返回NULL
}
void addMember(Tree root) {//添加成员
    char name[100], generation,b[10], gender, birth[11], death[11];
    InputBox(name, 100, "请输入成员姓名:");
    InputBox(b, 100, "请输入性别(M/F):");
    gender = b[0];
    InputBox(birth, 100, "请输入出生日期(格式:yyyy-mm-dd):");
    InputBox(death, 100, "请输入死亡日期(格式:yyyy-mm-dd,如在世请输入“-”):");
    Tree node = createNode(name, 1, gender, birth, death);
    InputBox(name, 100, "请选择该成员的父亲或母亲姓名:");
    Tree parent = searchNode(root, name);
    if (parent == NULL) {
        settextcolor(YELLOW);
        settextstyle(25, 0, _T("楷体"));
        outtextxy(690, 200, "未找到他的父母,请确认后重试"); 
        return;
    }
    insertChild(parent, node);
    node->generation = parent->generation + 1;
    settextcolor(YELLOW);
    settextstyle(25, 0, _T("楷体"));
    outtextxy(690, 200, "添加成功");
}
void modifyMember(Tree root) {// 修改成员信息
    char name[100], birth[100], death[100];
    InputBox(name, 100, "请输入要修改信息的成员姓名:");
    Tree node = searchNode(root, name);
    if (node == NULL) {
        settextcolor(YELLOW);
        settextstyle(50, 0, _T("楷体"));
        outtextxy(690, 200, "没查到");
        return;
    }
    InputBox(birth, 100, "请输入新的出生日期(格式:2002-12-28):");
    strcpy(node->birth, birth);
    InputBox(name, 100, "请输入新的死亡日期(格式:2002-12-28,如在世请输入“-”):");
    strcpy(node->death, death);
    settextcolor(YELLOW);
    settextstyle(25, 0, _T("楷体"));
    outtextxy(690, 200, "修改成功");
}
void deleteMember(Tree root) {//删除成员
    char name[100];
    InputBox(name, 100, "请输入要删除的成员姓名:");
    Tree node = searchNode(root, name);
    if (node == NULL) {
        settextcolor(YELLOW);
        settextstyle(50, 0, _T("楷体"));
        outtextxy(690, 200, "没找到");
        return;
    }
    // 删除该节点及其所有子节点
    if (node == root) { // 如果要删除的是根节点,则直接释放整个家谱
        free(root);
        settextcolor(YELLOW);
        settextstyle(50, 0, _T("楷体"));
        outtextxy(690, 200, "家谱已经清空");
        return;
    }
    Tree parent = findParent(root, node);
    Tree child = parent->firstChild;
    while (child != NULL) { // 在父节点的子节点链表中删除该节点
        if (child == node) { // 找到要删除的节点
            if (child == parent->firstChild) { // 如果要删除的节点是第一个子节点,则直接将其后面的节点作为父节点的第一个子节点
                parent->firstChild = child->nextSibling;
            }
            else { // 否则在子节点链表中删除该节点
                Tree sibling = parent->firstChild;
                while (sibling->nextSibling != child) {
                    sibling = sibling->nextSibling;
                }
                sibling->nextSibling = child->nextSibling;
            }
            free(node); // 释放要删除的节点
            settextcolor(YELLOW);
            settextstyle(25, 0, _T("楷体"));
            outtextxy(690, 200, "删除成功");
            return;
        }
        child = child->nextSibling;
    }
}
void anjian()
{
    settextcolor(YELLOW);
    settextstyle(50, 0, _T("楷体"));
    outtextxy(20, 50, _T("显示家谱"));
    settextcolor(YELLOW);
    settextstyle(50, 0, _T("楷体"));
    outtextxy(20, 150, _T("查找成员"));
    settextcolor(YELLOW);
    settextstyle(50, 0, _T("楷体"));
    outtextxy(20, 250, _T("添加成员"));
    settextcolor(YELLOW);
    settextstyle(50, 0, _T("楷体"));
    outtextxy(20, 350, _T("修改成员"));
    settextcolor(YELLOW);
    settextstyle(50, 0, _T("楷体"));
    outtextxy(20, 450, _T("删除成员"));
    settextcolor(YELLOW);
    settextstyle(50, 0, _T("楷体"));
    outtextxy(20, 550, _T("退出"));
}
void fanhui()
{
    settextcolor(YELLOW);
    settextstyle(50, 0, _T("楷体"));
    outtextxy(900, 600, _T("返回"));
}
void tuichu()
{
    settextcolor(YELLOW);
    settextstyle(50, 0, _T("楷体"));
    outtextxy(380, 1, _T("真的要退出吗?"));
    settextcolor(YELLOW);
    settextstyle(50, 0, _T("楷体"));
    outtextxy(170, 100, _T("嗯,下次再见"));
    settextcolor(YELLOW);
    settextstyle(50, 0, _T("楷体"));
    outtextxy(610, 100, _T("算了,再待一会"));
}
void chazhaoanjian()
{
    settextcolor(RED);
    settextstyle(25, 0, _T("楷体"));
    outtextxy(130, 1, _T("按姓名查"));
    outtextxy(430, 1, _T("按辈分查"));
    outtextxy(726, 1, _T("查父母"));
    outtextxy(128, 352, _T("查子女"));
    outtextxy(428, 351, _T("查兄弟"));
}
int main()
{
    char name[100];
    int n;
    char a[100], b, c[100], d[100], e[100];
    int generation;
    fstream file;
    file.open("D:\\算法\\家谱系统\\jiapu.txt", ios::in);
    file >> a >> generation >> b >> c >> d >> e;
    Tree node1 = createNode(a, generation, b, c, d);
    while (!file.eof())
    {
        file >> a >> generation >> b >> c >> d >> e;
        Tree node2 = createNode(a, generation, b, c, d);
        Tree node3 = searchNode(node1, e);
        insertChild(node3, node2);
    }
    initgraph(1000, 700);
    IMAGE backgroung;
    loadimage(&backgroung, _T("D:\\SteamLibrary\\steamapps\\workshop\\content\\431960\\2931161999\\preview.jpg"), 1000, 700);
    putimage(0, 0, &backgroung);
    anjian();//按键
    fanhui();//返回按键
    while (1)
    {
        BeginBatchDraw();
        putimage(0, 0, &backgroung);
        anjian();
        MOUSEMSG msg = GetMouseMsg();
        if (msg.x > 20 && msg.x < 220 && msg.y>50 && msg.y < 100 && msg.uMsg == WM_LBUTTONDOWN)//显示家谱
        {
            IMAGE bg;
            loadimage(&bg, _T("D:\\SteamLibrary\\steamapps\\workshop\\content\\431960\\2953870227\\preview.jpg"), 1000, 700);
            putimage(0, 0, &bg);
            settextcolor(RED);
            settextstyle(25, 0, _T("楷体"));
            outtextxy(130, 1, _T("第一代"));
            outtextxy(260, 1, _T("第二代"));
            outtextxy(390, 1, _T("第三代"));
            outtextxy(510, 1, _T("第四代"));
            outtextxy(640, 1, _T("第五代"));
            outtextxy(770, 1, _T("第六代"));
            outtextxy(900, 1, _T("第七代"));
            traverseTree(node1);
            huanyuan();
            fanhui();
            while (1)
            {
                BeginBatchDraw();
                fanhui();
                MOUSEMSG m1 = GetMouseMsg();
                if (m1.x > 900 && m1.x < 1000 && m1.y>600 && m1.y < 650 && m1.uMsg == WM_LBUTTONDOWN)
                {
                    break;
                }
                FlushBatchDraw();
            }
        }
        else if (msg.x > 20 && msg.x < 220 && msg.y>150 && msg.y < 200 && msg.uMsg == WM_LBUTTONDOWN)//查找成员
        {
            IMAGE bg;
            loadimage(&bg, _T("D:\\SteamLibrary\\steamapps\\workshop\\content\\431960\\2809204709\\preview.jpg"), 1000, 700);
            putimage(0, 0, &bg);
            fanhui();
            chazhaoanjian();
            while (1)
            {
                BeginBatchDraw();
                putimage(0, 0, &bg);
                chazhaoanjian();
                fanhui();
                MOUSEMSG m1 = GetMouseMsg();
                if (m1.x > 130 && m1.x < 230 && m1.y>1 && m1.y < 26 && m1.uMsg == WM_LBUTTONDOWN)//查姓名
                {
                    IMAGE b1;
                    loadimage(&b1, _T("C:\\Users\\86178\\Pictures\\Saved Pictures\\085237m64ya4rfleumyxe4.jpg"), 1000, 700);
                    putimage(0, 0, &b1);
                    char s[100];
                    InputBox(s, 100, "请输入姓名");
                    chazhao(node1, s);
                    fanhui();
                    while (1)
                    {
                        BeginBatchDraw();
                        fanhui();
                        MOUSEMSG m1 = GetMouseMsg();
                        if (m1.x > 900 && m1.x < 1000 && m1.y>600 && m1.y < 650 && m1.uMsg == WM_LBUTTONDOWN)
                        {
                            break;
                        }
                        FlushBatchDraw();
                    }
                }
                else if (m1.x > 430 && m1.x < 530 && m1.y>1 && m1.y < 26 && m1.uMsg == WM_LBUTTONDOWN)//查辈分
                {
                    IMAGE b2;
                    loadimage(&b2, _T("C:\\Users\\86178\\Pictures\\Saved Pictures\\e40a20ca39dbb6fd24061bf14c24ab18952b37de.jpg"), 1000, 700);
                    putimage(0, 0, &b2);
                    char str[100];
                    InputBox(str, 100, "请输入要查找的辈分");
                    n = atoi(str);
                    beifen(node1,n);
                    fanhui();
                    while (1)
                    {
                        BeginBatchDraw();
                        fanhui();
                        MOUSEMSG m1 = GetMouseMsg();
                        if (m1.x > 900 && m1.x < 1000 && m1.y>600 && m1.y < 650 && m1.uMsg == WM_LBUTTONDOWN)
                        {
                            break;
                        }
                        FlushBatchDraw();
                    }
                }
                else if (m1.x > 726 && m1.x < 826 && m1.y>1 && m1.y < 26 && m1.uMsg == WM_LBUTTONDOWN)//查父母
                {
                    IMAGE b3;
                    loadimage(&b3, _T("D:\\SteamLibrary\\steamapps\\workshop\\content\\431960\\2954397085\\preview.jpg"), 1000, 700);
                    putimage(0, 0, &b3);
                    char str[100];
                    InputBox(str, 100, "请输入要查找谁的父母");
                    Tree node = searchNode(node1, str);
                    Tree node2 = findParent(node1, node);
                    settextcolor(RED);
                    settextstyle(25, 0, _T("楷体"));
                    outtextxy(500, 50, "他的家长是:");
                    outtextxy(500, 100, node2->name);
                    fanhui();
                    while (1)
                    {
                        BeginBatchDraw();
                        fanhui();
                        MOUSEMSG m1 = GetMouseMsg();
                        if (m1.x > 900 && m1.x < 1000 && m1.y>600 && m1.y < 650 && m1.uMsg == WM_LBUTTONDOWN)
                        {
                            break;
                        }
                        FlushBatchDraw();
                    }
                }
                else if(m1.x > 900 && m1.x < 1000 && m1.y>600 && m1.y < 650 && m1.uMsg == WM_LBUTTONDOWN)
                {
                        break;
                }
                FlushBatchDraw();
            }
        }
        else if (msg.x > 20 && msg.x < 220 && msg.y>250 && msg.y < 300 && msg.uMsg == WM_LBUTTONDOWN)//添加成员
        {
            IMAGE bg;
            loadimage(&bg, _T("D:\\SteamLibrary\\steamapps\\workshop\\content\\431960\\2954915142\\preview.jpg"), 1000, 700);
            putimage(0, 0, &bg);
            fanhui();
            addMember(node1);
            while (1)
            {
                BeginBatchDraw();
                fanhui();
                MOUSEMSG m1 = GetMouseMsg();
                if (m1.x > 900 && m1.x < 1000 && m1.y>600 && m1.y < 650 && m1.uMsg == WM_LBUTTONDOWN)
                {
                    break;
                }
                FlushBatchDraw();
            }
        }
        else if (msg.x > 20 && msg.x < 220 && msg.y>350 && msg.y < 400 && msg.uMsg == WM_LBUTTONDOWN)//修改成员
        {
            IMAGE bg;
            loadimage(&bg, _T("D:\\SteamLibrary\\steamapps\\workshop\\content\\431960\\2771613746\\preview.jpg"), 1000, 700);
            putimage(0, 0, &bg);
            fanhui();
            modifyMember(node1);
            while (1)
            {
                BeginBatchDraw();
                fanhui();
                MOUSEMSG m1 = GetMouseMsg();
                if (m1.x > 900 && m1.x < 1000 && m1.y>600 && m1.y < 650 && m1.uMsg == WM_LBUTTONDOWN)
                {
                    break;
                }
                FlushBatchDraw();
            }
        }
        else if (msg.x > 20 && msg.x < 220 && msg.y>450 && msg.y < 500 && msg.uMsg == WM_LBUTTONDOWN)//删除成员
        {
            IMAGE bg;
            loadimage(&bg, _T("C:\\Users\\86178\\Pictures\\Saved Pictures\\20220726235757_54919.jpeg"), 1000, 700);
            putimage(0, 0, &bg);
            fanhui();
            deleteMember(node1);
            while (1)
            {
                BeginBatchDraw();
                fanhui();
                MOUSEMSG m1 = GetMouseMsg();
                if (m1.x > 900 && m1.x < 1000 && m1.y>600 && m1.y < 650 && m1.uMsg == WM_LBUTTONDOWN)
                {
                    break;
                }
                FlushBatchDraw();
            }
        }
        else if (msg.x > 20 && msg.x < 120 && msg.y>550 && msg.y < 600 && msg.uMsg == WM_LBUTTONDOWN)// 退出
        {
            tuichu();
            IMAGE backgroung;
            loadimage(&backgroung, _T("D:\\SteamLibrary\\steamapps\\workshop\\content\\431960\\2934572611\\preview.jpg"), 1100, 800);
            putimage(0, 0, &backgroung);
            while (1)
            {
                BeginBatchDraw();
                tuichu();
                MOUSEMSG m1 = GetMouseMsg();
                if (m1.x > 170 && m1.x < 470 && m1.y>100 && m1.y < 150 && m1.uMsg == WM_LBUTTONDOWN)
                {
                    break;
                }
                else if (m1.x > 610 && m1.x < 960 && m1.y>100 && m1.y < 150 && m1.uMsg == WM_LBUTTONDOWN)
                {
                    goto GG;
                }
                FlushBatchDraw();
            }
            closegraph();
        GG:
            continue;
        }
        FlushBatchDraw();
    }
    system("pause");
}

4:文件内容在这里

唐晨 1 M 1000 1222 无
唐昊 2 M 1022 1225 唐晨
唐三 3 M 1122 1322 唐昊
唐舞桐 4 F 1206 1348 唐三
唐雨浩 5 M 1265 1451 唐舞桐
唐小桐 5 M 1268 1436 唐舞桐
唐二桐 6 F 1309 1559 唐小桐
唐皮蛋 7 M 1333 1540 唐二桐
唐三桐 7 F 1315 1594 唐小桐
唐建国 8 M 1343 1585 唐三桐
唐舞麟 4 F 1224 1374 唐三
唐轩宇 5 M 1266 1486 唐舞麟
唐小轩 6 M 1300 1560 唐轩宇
唐二轩 7 F 1330 1532 唐小轩

图片的话你可以找你喜欢的。

对了,查找中查兄弟,查子女我还没写,后续再写,所以你点了那里没反应正常。

都看到这里了,点个赞再走吧!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/445642.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Pytorch深度学习笔记(五)反向传播算法

推荐课程&#xff1a;04.反向传播_哔哩哔哩_bilibili 1.为什么要使用反向传播算法 简单模型可以使用解析式更新w 复杂模型&#xff0c;如图&#xff0c;输入矩阵为5*1矩阵&#xff0c;等一层权重矩阵H1为6*5矩阵&#xff0c;则需要30个解析式&#xff0c;第二层权重矩阵H2为6…

1685_Excel的几种脚本处理方式

全部学习汇总&#xff1a; GreyZhang/python_basic: My learning notes about python. (github.com) 做个小结&#xff0c;实际上是写的我自己学习的过程。 关于Excel的处理方式很多&#xff0c;我也不会那么多&#xff0c;在这里我只想写一下我自己接触过的。大致是三种方式&a…

Pikachu靶场(Cross-Site Scripting)

Cross-Site Scripting 反射型xss(get)源代码修改限制地址栏 反射性xss(post)存储型xssDOM型xss-xxss盲打xss之过滤xss之htmlspecialcharsxss之href输出xss之js输出 Cross-Site Scripting 简称为“CSS”&#xff0c;为避免与前端叠成样式表的缩写"CSS"冲突&#xff0c…

《花雕学AI》25:用文字画出你的非凡想象力,微软新Bing带你体验DALL-E的神奇

你有没有想过用文字来画画&#xff1f;这听起来可能很不可思议&#xff0c;但是现在&#xff0c;你可以通过微软新Bing来实现这个想法。微软新Bing支持AI绘画功能&#xff0c;只要输入一句话&#xff0c;就能生成一幅图像。这个功能是由DALL-E驱动的&#xff0c;DALL-E是一个能…

mybatis03-多表查询、延迟加载、逆向工程

mybatis03 mybatis 多表联查 背景产生&#xff1a;开发过程中单表查询 不能满足项目需求分析功能。对于复杂业务来说&#xff0c;关联的表有几张&#xff0c;甚至几十张 并且表与表之间的关系相当复杂。目的&#xff1a;实现复杂业务功能&#xff0c;必须进行多表查询&#x…

开发插件JFormDesigner(可视化GUI编程)的使用与注册-简单几步即可完成

开发插件JFormDesigner&#xff08;可视化GUI编程&#xff09;的使用与注册 获取链接&#xff1a;1.JFormDesigner获取2.记录插件下载路径3.使用zcj注册4.生成license5.打开idea进行注册 获取链接&#xff1a; https://pan.baidu.com/s/1N9ua2p3BpiMIARCEewRxIw?pwd4e9a 提取…

WebSocket 通信 —— 浏览器原生支持

在上一篇内容中讲到使用Node中的Net核心模块完成socket通信&#xff0c;那么本篇就继续来讲关于浏览器原生支持的 WebSocket &#xff0c;实现通信。那么什么是 WebSocket ? 它是HTML5开始提供的一种浏览器与服务器间进行全双工&#xff08;全双工&#xff1a;同时进行双向传输…

激活函数(Activation Function)及十大常见激活函数

目录 1 激活函数的概念和作用 1.1 激活函数的概念 1.2 激活函数的作用 1.3 通俗地理解一下激活函数&#xff08;图文结合&#xff09; 1.3.1 无激活函数的神经网络 1.3.2 带激活函数的神经网络 2 神经网络梯度消失与梯度爆炸 2.1 简介梯度消失与梯度爆炸 2.2 梯度不稳…

asp.net+C#房地产销售系统文献综述和开题报告+Lw

本系统使用了B/S模式&#xff0c;使用ASP.NET语言和SQL Server来设计开发的。首先把所有人分为了用户和管理员2个部分&#xff0c;一般的用户可以对系统的前台进行访问&#xff0c;对一般的信息进行查看&#xff0c;而注册用户就可以通过登录来完成对房屋信息的查看和对房屋的…

动态通讯录——C语言【详解+全部码源】

作者简介&#xff1a; 辭七七&#xff0c;目前大一&#xff0c;正在学习C/C&#xff0c;Java&#xff0c;Python等 作者主页&#xff1a; 七七的个人主页 文章收录专栏&#xff1a;进阶C语言&#xff0c;本专栏主要讲解数据存储&#xff0c;进阶指针&#xff0c;动态内存管理&a…

企业数据安全能力建设思路

在现代社会&#xff0c;企业数据安全已经成为一个非常重要的话题。企业数据安全能力的建设是每个企业都必须面对和解决的问题。企业数据安全能力建设思路包括以下几个方面&#xff1a; 1. 建立完善的安全管理制度 企业要建立完善的安全管理制度&#xff0c;包括信息安全政策、…

[入门必看]数据结构5.1:树的基本概念

[入门必看]数据结构5.1&#xff1a;树的基本概念 第五章 树与二叉树5.1 树的基本概念知识总览5.1.15.1.2 树的定义和基本术语5.1.3 树的性质 5.1.15.1.2 树的定义和基本术语树的基本概念树形逻辑结构的应用结点之间的关系描述结点、树的属性描述有序树 V.S 无序树树 V.S 森林 5…

软考 软件设计师上午题uml

UML uml事物依赖关系关联聚合组合关系泛化关系实现关系关联多重度UML类图UML 类图的概念对象图用例图包含关系扩展关系泛化关系用例图概念交互图通信图![在这里插入图片描述](https://img-blog.csdnimg.cn/d62c6f00d57a48949e3306461f3fbe25.png)通信图例子状态图状态图的状态和…

# 生成器

生成器 生成器是什么&#xff1f; 生成器&#xff08;generator&#xff09;是一种用来生成数据的对象。它们是普通函数的一种特殊形式&#xff0c;可以用来控制数据的生成过程。 生成器有什么优势&#xff1f; 使用生成器的优势在于它们可以在生成数据的同时控制数据的生成过程…

android ContentObserver实时监测媒体图片增删改,java(1)

android ContentObserver实时监测媒体图片增删改,java&#xff08;1&#xff09; <uses-permission android:name"android.permission.READ_EXTERNAL_STORAGE"/><uses-permission android:name"android.permission.READ_MEDIA_IMAGES" /> impl…

七、JS07使用 jQuery 操作 DOM

七、使用 jQuery 操作 DOM 7.1 DOM 操作 7.1.1 DOM 操作分类 使用 JavaScript 操作 DOM 时分为三类——DOM Core(核心)、HTML-DOM 和 CSS-DOMjQuery 操作也同样分为这三类下面主要回顾以下 JavaScript 中的 DOM 操作 JavaScript 中的 getElementById()、getElementByTagName…

c++内联函数inline

目录 内联函数的概念&#xff1a; 内联函数的用法&#xff1a; 内联的优点&#xff1a; 内联的缺点&#xff1a; 内联的使用场景 内联注意事项&#xff1a; 内联函数的概念&#xff1a; C中内联&#xff08;inline&#xff09;是一种关键字&#xff0c;用于告诉编译器把函…

以太网和DNS

以太网 数据链路层考虑的是相邻俩个节点之间的传输(通过网线/光纤/无线直接相连的设备),数据链路层中最典型的协议就说"以太网" 以太网协议规定了数据链路层,也规定了物理层的内容,我们使用的网线,也叫做"以太网线"(遵守以太网协议的网线) 以太网帧格式…

使用RecyclerView开发TabView

github链接 demo代码 效果图 这个功能是使用RecyclerView开发的&#xff0c;需要解决下面这些问题 单个item滚动的问题&#xff1a;左边的view需要固定、手指松开之后&#xff0c;惯性的处理滑动布局子View事件分发冲突的解决多个item联合滚动滚动header解决itemView与Recycl…

【MYSQL】表的增删改查(进阶)

文章目录 &#x1f337; 1. 数据库约束⭐ 1.1 约束类型⭐ 1.2 NULL约束⭐ 1.3 UNIQUE&#xff1a;唯一约束⭐ 1.4 DEFAULT&#xff1a;默认值约束⭐ 1.5 PRIMARY KEY&#xff1a;主键约束⭐ 1.6 FOREIGN KEY&#xff1a;外键约束⭐ 1.7 CHECK约束&#xff08;了解&#xff09; …