C++职工管理系统(具备增删改查功能 涉及文件操作、指针数组操作、升序降序、多态、虚函数)

news2024/9/24 15:27:35

目录

  • 🌕需求分析
  • 🌕创建项目
  • 🌕完整代码
    • 🌙项目结构
    • 🌙include
      • ⭐worker.h (它是后面employ,boss,manager的基类)
      • ⭐boss.h
      • ⭐employee.h
      • ⭐manager.h
      • ⭐workerManager.h
    • 🌙src
      • ⭐boss.cpp
      • ⭐employee.cpp
      • ⭐manager.cpp
      • ⭐workerManager.cpp
    • 🌙tasks.json
    • 🌙main.cpp
  • 🌕一步一步的实现功能
    • 🌙菜单功能实现
    • 🌙退出功能实现
    • 🌙添加职工功能
    • 🌙初始化运行时读取员工信息文件功能
      • ⭐第一次使用,文件未创建的情况
      • ⭐文件存在,但是数据被用户清空的情况
      • ⭐文件存在,并且已经保存了职工的所有数据的情况
    • 🌙显示职工信息
    • 🌙删除职工
      • ⭐判断要删除的员工号是否存在?
      • ⭐实现删除员工功能
    • 🌙修改职工信息
    • 🌙查找职工
  • 🌕参考视频

🌕需求分析

⭐职工分为三类:

老板 Boss
经理 Manager
普通员工 Employee

⭐显示信息时需要显示:

职工编号
姓名
岗位
职责 Duty
普通员工职责:完成经理交代的任务。
经理职责:完成老板交给的任务,并下发任务给员工。
老板职责:管理公司所有事务。

⭐要实现的功能:

在这里插入图片描述

🌕创建项目

windwos下vscode多文件项目Employee_Manager的创建、编译、运行

🌕完整代码

🌙项目结构

在这里插入图片描述

🌙include

⭐worker.h (它是后面employ,boss,manager的基类)

#pragma once
#include<iostream>
#include<string>
using namespace std;

// 职工抽象基类
class Worker
{
private:
    
public:
    int m_Id; //worker number
    string m_Name; //worker name;
    int m_DeptId;//职工所在的部门名称编号

    // show personal information.
    virtual void showInfo()=0;

    // get the dept of worker
    virtual string getDeptName() = 0;    
};

⭐boss.h

#pragma once
#include<iostream>
using namespace std;
#include "worker.h"

//员工类
class Boss :public Worker
{
public:
    //构造函数
    Boss(int id,string name,int dId);

    //展示个人信息
    virtual void showInfo();

    //获取职工岗位名称
    virtual string getDeptName();
};

⭐employee.h

#pragma once
#include<iostream>
using namespace std;
#include "worker.h"

//员工类
class Employee :public Worker
{
public:
    //构造函数
    Employee(int id,string name,int dId);

    //展示个人信息
    virtual void showInfo();

    //获取职工岗位名称
    virtual string getDeptName();
};

⭐manager.h

#pragma once
#include<iostream>
using namespace std;
#include "worker.h"

// 经理类: 经理类有经理的个人信息,有岗位名称
class Manager :public Worker
{
public:
    Manager(int id,string name,int dId);

    //显示个人信息
    virtual void showInfo();

    //获取职工岗位名称
    virtual string getDeptName();

};

⭐workerManager.h

#pragma once
#include<iostream>
#include"worker.h"
#include"employee.h"
#include"boss.h"
#include"manager.h"
#include<fstream>
#define FILENAME "empFile.txt"
using namespace std;

class WorkerManager
{
public:
    // 记录职工的个数
    int m_EmpNum;

    // 存放职工的指针数组 worker* a; 
    Worker ** m_EmpArray;

    // 文件为空的标志
    bool m_FileIsEmpty;

    //构造函数
    WorkerManager();

    // 统计文件中的人数
    int get_EmpNum();

    //当文件里面有员工信息 读取它们
    void init_Emp();

    //显示职工
    void show_Emp();

    //删除时需要先判断输入的职工id是否存在。存在则返回该职工在数组中的位置,不存在返回-1
    //修改,查找,删除都需要用到该函数。
    int isExist(int id);

    //删除员工
    void del_Emp();

    //展示菜单
    void showMenu();

    //退出系统
    void exitSystem();

    //添加员工函数
    void add_Emp();

    //modify employee
    void mod_Emp();

    // find employee
    void find_Emp();

    // two way for sort.
    void sort_Emp();

    // clean file.
    void clean_File();

    void save();

    //析构函数
    ~WorkerManager();

};

🌙src

⭐boss.cpp

#include "boss.h"

Boss::Boss(int id,string name,int dId)
{
    this->m_Id = id;
    this->m_Name = name;
    this->m_DeptId = dId;
}

void Boss::showInfo()
{
    cout<<"Num:"<<this->m_Id
        <<"\tName:"<<this->m_Name
        <<"\tDept:"<<this->getDeptName()
        <<"\tDuty: Managing the company's overall affairs."<<endl;
}

string Boss::getDeptName()
{
    return string("Boss");
}

⭐employee.cpp

#include "employee.h"

Employee::Employee(int id,string name,int dId)
{
    this->m_Id = id;
    this->m_Name = name;
    this->m_DeptId = dId;
}

void Employee::showInfo()
{
    cout<<"Num:"<<this->m_Id
        <<"\tName:"<<this->m_Name
        <<"\tDept:"<<this->getDeptName()
        <<"\tDuty: Completing tasks assigned by the manager."<<endl;
}

string Employee::getDeptName()
{
    return string("Employee");
}

⭐manager.cpp

#include "manager.h"

Manager::Manager(int id,string name,int dId)
{
    this->m_Id = id;
    this->m_Name = name;
    this->m_DeptId = dId;
}

void Manager::showInfo()
{
    cout<<"Num:"<<this->m_Id
        <<"\tName:"<<this->m_Name
        <<"\tDept:"<<this->getDeptName()
        <<"\tDuty: Completing tasks assigned by the boss and distributing them to regular employees."<<endl;
}

string Manager::getDeptName()
{
    return string("Manager");
}

⭐workerManager.cpp

#include "boss.h"

Boss::Boss(int id,string name,int dId)
{
    this->m_Id = id;
    this->m_Name = name;
    this->m_DeptId = dId;
}

void Boss::showInfo()
{
    cout<<"Num:"<<this->m_Id
        <<"\tName:"<<this->m_Name
        <<"\tDept:"<<this->getDeptName()
        <<"\tDuty: Managing the company's overall affairs."<<endl;
}

string Boss::getDeptName()
{
    return string("Boss");
}

🌙tasks.json

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe 生成活动文件",
            "command": "C:\\Users\\X2006600\\Desktop\\MinGW\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g","${file}","${fileDirname}\\src\\*.cpp",
                "-I","${fileDirname}\\include",
                "-o","${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "调试器生成的任务。"
        }
    ],
    "version": "2.0.0"
}

🌙main.cpp

#include<iostream>
using namespace std;
#include "workerManager.h"
#include "boss.h"
#include "employee.h"
#include "manager.h"

void test()
{
    Worker *worker = NULL;
    worker = new Employee(1,"Bruce",1);
    worker->showInfo();
    delete worker;

    worker = new Manager(2,"Tom",2);
    worker->showInfo();
    delete worker;

    worker = new Boss(3,"Jerry",3);
    worker->showInfo();
    delete worker;
}

int main()
{
    //声明一个管理系统类
    WorkerManager wm;
    int choice = 0;
    while (true)
    {
        //展示菜单
        wm.showMenu();
        cout<<"Please input the number you choiced:";
        cin>>choice;
        switch (choice)
        {
        case 0: //exit system;
            wm.exitSystem();
            break;
        case 1: //add employee
            wm.add_Emp();
            break;
        case 2: //show employee
            wm.show_Emp();
            break;
        case 3: //delete employee
            wm.del_Emp();
            break;
        case 4: //modify employee information
            wm.mod_Emp();
            break;
        case 5: //find employee information
            wm.find_Emp();
            break;
        case 6:
            wm.sort_Emp();
            break;
        case 7:
            wm.clean_File();
            break;
        default:
            break;
        }
    }
    
    system("Pause");
    return 0;
}

🌕一步一步的实现功能

🌙菜单功能实现

🌙退出功能实现

🌙添加职工功能


批量添加职工,并且保存到文件中。

用户在批量创建时可能会创建不同种类的职工。

因此这个数组是不定长的,可以增加的。

这个数组可以容纳不同种类员工,所以数组单元的类型可以是指针。


workerManager.h文件下

void add_Emp();

workerManager.cpp文件下:

void WorkerManager::add_Emp()
{
    cout << "Please enter the number of employees to be added:"<<endl;
    int addNum = 0;
    cin >> addNum;
    if (addNum > 0)
    {
        int newSize = this->m_EmpNum + addNum;


        Worker** newSpace = new Worker* [newSize];

        if (this->m_EmpArray != NULL)
        {
            for (int i = 0; i < this->m_EmpNum; i++)
            {
                newSpace[i] = this->m_EmpArray[i];
            }
        }

        for (int i = 0; i < addNum; i++)
        {
            int id;
            string name;
            int dSelect;

            cout << "Please enter the ID of the " << i + 1 << " employee:" << endl;
            cin >> id; 

            cout << "Please enter the name of the " << i + 1 << " employee:" << endl;
            cin >> name;

            cout << "Please select the dept for this employee:";
            cout << "1.Employee." << endl;
            cout << "2.Manager." << endl;
            cout << "3.Boss." << endl;
            cin >> dSelect;

            Worker *worker = NULL;
            switch (dSelect)
            {
            case 1: 
                worker = new Employee(id, name, 1);
                break;

            case 2: 
                worker = new Manager(id, name, 2);
                break;

            case 3: 
                worker = new Boss(id, name, 3);
                break;

            default:
                break;
            }
            newSpace[this->m_EmpNum + i] = worker;
        }
        delete[] this->m_EmpArray;
        this->m_EmpArray = newSpace;
        this->m_EmpNum = newSize;
        this->m_FileIsEmpty = false;
        cout << "Successfully added " << addNum << " new employees!" << endl;
        this->save();
    }
    else
    {
        cout << "Your input is incorrect." << endl;
    }
    system("pause");
    system("cls");
}

🌙初始化运行时读取员工信息文件功能

⭐第一次使用,文件未创建的情况

1.第一次使用,文件未创建。
2.文件存在,但是数据被用户清空。
3.文件存在,并且保存职工的所有数据。

在WorkerManager.h头文件中加入

bool m_fileIsEmpty;

修改WorkerManager.cpp的构造函数为:

WorkerManager::WorkerManager()
{
    ifstream ifs;
    ifs.open(FILENAME,ios::in);
    //文件不存在的情况
    if(!ifs.is_open())
    {   
        cout<<"The file does not exist."<<endl;
        //初始化文件为空的标志
        this->m_FileIsEmpty = true;
        //初始化人数
        this->m_EmpNum = 0;
        //初始化数组指针
        this->m_EmpArray = NULL;
        ifs.close(); //关闭文件
        return;
    }
    
}

⭐文件存在,但是数据被用户清空的情况

思路:读取一个字符,判断它是否是文件末尾的标志,如果是,则表示文件为空。

eof 是文件尾部的标志
    //----------------判断文件存在并且没有记录的情况-------------------
    char ch;
    ifs>>ch; // 读取一个字符,下一行判断它是否是文件末尾
    if(ifs.eof()) // eof是文件尾部的标志
    {
        cout<<"The file is empty!"<<endl;
        this->m_EmpNum = 0; //职工人数设置为0
        this->m_FileIsEmpty = true; //文件为空设置为true
        this->m_EmpArray = NULL; //存放职员的数组设置为空
        ifs.close();
        return;
    }
当添加职工成功之后,要更新 m_FileIsEmpty = false

⭐文件存在,并且已经保存了职工的所有数据的情况

在workerManager.h头文件中加入成员函数

int get_EmpNum();
void init_Emp();

在workerManager.cpp中实现这两个成员函数:

int WorkerManager::get_EmpNum()
{
    ifstream ifs;
    ifs.open(FILENAME,ios::in);
    
    int id;
    string name;
    int dId;

    int num = 0;
    while(ifs>>id && ifs>>name && ifs>>dId) //读第一行的数据
    {
        //记录人数
        num++;
    }
    ifs.close();
    return num;
}
void WorkerManager::init_Emp()
{
    ifstream ifs;
    ifs.open(FILENAME,ios::in);

    int id;
    string name;
    int dId;

    int index = 0;
    while (ifs>>id && ifs>>name && ifs>>dId)
    {
        Worker* worker = NULL;
        //根据不同的部门id创建不同的对象
        if(dId ==1) //普通员工
        {
            worker = new Employee(id,name,dId);
        }
        else if (dId ==2) //经理
        {
            worker = new Manager(id,name,dId);
        }
        else //老板
        {
            worker = new Boss(id,name,dId);
        }
        //将创建好的职工存放到数组里
        this->m_EmpArray[index] = worker;
        index++;
    }
    //关闭文件
    ifs.close();
}

构造函数中添加:

//---------------------文件存在并且里面有数据-------------------------
    int num = this->get_EmpNum();
    cout<<"Now, we have "<<num<<" employees."<<endl;
    this->m_EmpNum = num; //更新成员属性
    
    //更新文件是否为空的标志为 false
    this->m_FileIsEmpty = false;
    
    // 根据职工数创建数组
    this->m_EmpArray = new Worker* [this->m_EmpNum];
    // 初始化职工信息
    this->init_Emp();
    // 读取职工信息并输出
    for (int i=0;i<this->m_EmpNum;i++)
    {
        cout<<this->m_EmpArray[i]->m_Id<<" "<<this->m_EmpArray[i]->m_Name<<" "<<this->m_EmpArray[i]->m_DeptId<<endl;
    }

在这里插入图片描述

🌙显示职工信息

在workerManager.h头文件中加入成员函数

void show_Emp();

workerManager.cpp中实现该函数

void WorkerManager::show_Emp()
{
    if(this->m_FileIsEmpty)
    {
        cout<<"File is not exist or the file is empty!"<<endl;
    }
    else
    {
        for (int i = 0; i < this->m_EmpNum; i++)
        {
            //利用多态调用接口
            this->m_EmpArray[i]->showInfo();
        }
        
    }
    //暂停一下,按任意键取消暂停
    system("pause");
    system("cls");
}

🌙删除职工

⭐判断要删除的员工号是否存在?

先在workerManager.h中添加成员函数


//删除时需要先判断输入的职工id是否存在。存在则返回该职工在数组中的位置,不存在返回-1
//修改,查找,删除都需要用到该函数。
int isExist(int id);
void Del_Emp();

⭐实现删除员工功能

删除就是数据前移,并把数组长度减一。

在这里插入图片描述

🌙修改职工信息

workerManager.h中添加如下内容:

 //modify employee
 void mod_Emp();

workerManager.cpp中添加如下内容:

void WorkerManager::mod_Emp()
{
    if(this->m_FileIsEmpty)
    {
        cout<<"file is not exist or the data is null"<<endl;
    }
    else
    {
        cout<<"please input the id of this employee:";
        int id;
        cin>>id;

        int ret = this->isExist(id);
        if(ret!=-1)
        {
            // delete the old employee of this id.
            delete this->m_EmpArray[ret];
            int newId = 0;
            string newName = "";
            int dSelect = 0;

            // cout<<"The employee information with ID "<<id<<" has been found."<<endl;
            cout<<"Please input the new id of this employee:";
            cin>>newId;

            cout<<"Please input the new name of this employee:";
            cin>>newName;

            cout << "Please select the new dept for this employee:"<<endl;;
            cout << "1.Employee." << endl;
            cout << "2.Manager." << endl;
            cout << "3.Boss." << endl;
            cin >> dSelect;

            Worker* worker = NULL;
            switch (dSelect)
            {
            case 1:
                worker = new Employee(newId,newName,dSelect);
                break;
            case 2:
                worker = new Manager(newId,newName,dSelect);
                break;
            case 3:
                worker = new Boss(newId,newName,dSelect);
                break;
            default:
                break;
            }

            // update the new info to the EmpArray;
            this->m_EmpArray[ret] = worker;
            cout<<"modifies is sucessful! the new info is:"<<endl;
            this->m_EmpArray[ret]->showInfo();

            // save to file.
            this->save();
        }
        else
        {
            cout<<"Failed to modify, as the employee cannot be found."<<endl;
        }
    }

    system("pause");
    system("cls");

}

main.cpp中的case 4中调用 mod_Emp();

🌙查找职工

WorkerManager.h添加如下内容:

// find employee
void find_Emp();

WorkerManager.cpp添加如下内容:

void WorkerManager::find_Emp()
{
    // first, judge whether the file or data is exist?
    if(this->m_FileIsEmpty)
    {
        cout<<"file is doesn't exist or the data is null."<<endl;
    }
    else
    {
        cout<<"1.find by id."<<endl;
        cout<<"2.find by name."<<endl;
        cout<<"please input the method you select:";
        int select = 0;
        cin>>select;
        if (select==1)
        {
            cout<<"please input the id that you find:";
            int id,index;
            cin>>id;
            // whether the id is exist?
            index = this->isExist(id);
            if (index!=-1)
            {
                this->m_EmpArray[index]->showInfo();
            }
            else
            {
                cout<<"the id is not exist.";
            }
        }
        else if (select==2)
        {
            string name;
            cout<<"please the name you want to find:";
            cin>>name;
            bool flag = false;
            for (int i = 0; i < m_EmpNum; i++)
            {
                if (this->m_EmpArray[i]->m_Name==name)
                {
                    cout<<"sucessful! the info of employee that you find is:"<<endl;
                    this->m_EmpArray[i]->showInfo();
                    flag = true;
                }
                
            }
            if(flag==false)
            {
                cout<<"There is no one here named ."<<name<<endl;
            }
            
        }
        else
        {
            cout<<"mistake, please re-input."<<endl;
        }
    }
    system("pause");
    system("cls");
}

主函数中添加如下内容:

        case 5: //modify employee information
            wm.find_Emp();
            break;

🌕参考视频

B站黑马C++教程

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

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

相关文章

0911(绘制事件,qt中的网络通信)

一、实现一个时钟 1)代码 头文件&#xff1a; #ifndef WIDGET_H #define WIDGET_H#include <QWidget> #include <QPainter> #include <QPaintEvent> #include <QTimer> #include <QTime> #include <QTimerEvent>QT_BEGIN_NAMESPACE nam…

如何用Google Trend进行SEO优化?方法与策略

做SEO的都知道&#xff0c;Google Trend是一款免费工具&#xff0c;用户可以查看不同关键词的搜索趋势、兴趣强度和区域分布。通过 Google Trends&#xff0c;你可以获得以下信息&#xff0c;这些数据可以帮助您更好地了解用户需求并优化您的SEO策略&#xff1a; 1、搜索量趋势…

线结构光测量系统标定--导轨

光平面标定原理可查看之前的博文《光平面标定》&#xff0c;光条中心提取可参考线结构光专栏光条中心提取系列的文章&#xff0c;相机标定参考相机标定专栏中的博文。&#xff08;欢迎进Q群交流&#xff1a;874653199&#xff09; 线结构光测量系统(指一个线结构光传感器与一个…

如何检查前端项目中我们没有使用的第三方包

问题描述&#xff1a;我们在赶项目或者在做些功能或者效果的时候往往会用到很多的第三方包&#xff0c;那么时间一长&#xff0c;我们有时候会忘记删除这些包到底该怎么办呢&#xff1f;接下来教给大家一个方法。 在我们的项目根目录下面随便起一个.js的文件 代码如下&#x…

算法工程师重生之第四天(两两交换链表中的节点 删除链表的倒数第N个节点 链表相交 环形链表II 总结 )

参考文献 代码随想录 一、两两交换链表中的节点 给你一个链表&#xff0c;两两交换其中相邻的节点&#xff0c;并返回交换后链表的头节点。你必须在不修改节点内部的值的情况下完成本题&#xff08;即&#xff0c;只能进行节点交换&#xff09;。 示例 1&#xff1a; 输入&am…

掌握python的dataclass,让你的代码更简洁优雅!

"dataclass"是从"Python3.7"版本开始&#xff0c;作为标准库中的模块被引入。 随着"Python"版本的不断更新&#xff0c;"dataclass"也逐步发展和完善&#xff0c;为"Python"开发者提供了更加便捷的数据类创建和管理方式。 …

Element-UI 组件实现面包屑导航栏

Element-UI 组件实现面包屑导航栏 面包屑导航栏是一种辅助导航系统&#xff0c;它显示用户当前位置在网站或应用层次结构中的位置&#xff0c;可以帮助用户了解他们当前页面的位置&#xff0c;并且可以方便地返回到上级页面或首页。 面包屑导航栏的实现原理&#xff1a; 路径…

【网易低代码】第2课,页面表格查询功能

你好&#xff01; 这是一个新课程 CodeWave网易低代码 通过自然语言交互式智能编程&#xff0c;同时利用机器学 习&#xff0c;帮助低代码开发者进一步降低使用门槛、提高应用开发效率 【网易低代码】第2课&#xff0c;页面表格查询功能 1.拖拽表格组件到页面布局中2.服务端逻辑…

FFCD:森林火灾分类数据集(猫脸码客 第184期)

亲爱的读者们&#xff0c;您是否在寻找某个特定的数据集&#xff0c;用于研究或项目实践&#xff1f;欢迎您在评论区留言&#xff0c;或者通过公众号私信告诉我&#xff0c;您想要的数据集的类型主题。小编会竭尽全力为您寻找&#xff0c;并在找到后第一时间与您分享。 fores…

2024/9/11黑马头条跟学笔记(七)

1)今日内容介绍 搜索结果&#xff0c;搜索记录&#xff0c;搜索联想 搭建环境 索引&#xff0c;存储&#xff0c;分词 多条件复合查询 结果高亮处理 索引数据同步&#xff08;文章发布后创建索引 kafka&#xff09; 搭建mongodb&#xff0c;存储链和性能好过mysql 异步保…

56 - I. 数组中数字出现的次数

comments: true difficulty: 中等 edit_url: https://github.com/doocs/leetcode/edit/main/lcof/%E9%9D%A2%E8%AF%95%E9%A2%9856%20-%20I.%20%E6%95%B0%E7%BB%84%E4%B8%AD%E6%95%B0%E5%AD%97%E5%87%BA%E7%8E%B0%E7%9A%84%E6%AC%A1%E6%95%B0/README.md 面试题 56 - I. 数组中数…

【学习笔记】SSL证书密码套件之加密

本篇将介绍密码套件中加密常用的协议并将他们进行比较&#xff0c;包括&#xff1a;CHACHA20、AES-256-GCM、AES-128-GCM、AES-256-CBC、AES-128-CBC、3DES-CBC、RC4-128、DES-CBC 一、概念 &#xff08;选择以上合适协议&#xff09;对称加密算法 目的是保护批量数据传输流密…

linux从0到1 基础完整知识

1. Linux系统概述 Linux是一种开源操作系统&#xff0c;与Windows或macOS等操作系统不同&#xff0c;Linux允许用户自由地查看、修改和分发其源代码。以下是Linux系统的一些显著的优势。 稳定性和可靠性&#xff1a; 内核以其稳定性而闻名&#xff0c;能够持续运行数月甚至数…

Codeforces Round 971 (Div. 4)——C题题解

本题的大意是一个青蛙从原点开始跳格子(0,0)&#xff0c;最终要跳到点(x,y)去&#xff0c;并且每一步的步长不能超过k&#xff0c;问最短几步可以跳到终点 分析&#xff1a; 本题利用贪心思想&#xff0c;肯定是先跳最大的步长这样总体用的步数最长 代码演示&#xff1a; #inc…

等待唤醒机制和阻塞队列

1. 等待唤醒机制 由于线程的随机调度&#xff0c;可能会出现“线程饿死”的问题&#xff1a;也就是一个线程加锁执行&#xff0c;然后解锁&#xff0c;其他线程抢不到&#xff0c;一直是这个线程在重复操作 void wait() 当前线程等待&#xff0c;直到被其他线程唤醒 void no…

【QT】自制一个简单的时钟(跟随系统时间)

目录 源代码&#xff1a; 输出结果如下&#xff1a; 使用QT完成一个简单的时钟图形化界面&#xff0c;功能是完成了时分秒指针能够跟随系统时间移动 设计思路&#xff1a; 1、首先将时钟的边框绘制出来 2、定义出一个定时器t1&#xff0c;将定时器连接到update_slot槽内&#…

CSS 常用元素属性

CSS 属性有很多, 可以参考文档 CSS 参考手册 1. 字体属性 设置字体 多个字体之间使用逗号分隔. (从左到右查找字体, 如果都找不到, 会使用默认字体. )如果字体名有空格, 使用引号包裹.建议使用常见字体, 否则兼容性不好. <style>.one {font-family:"Microsoft Ya…

Docker数据卷介绍及相关操作

数据卷的介绍 数据卷&#xff08;Data Volumes&#xff09;&#xff1a;是一个虚拟目录&#xff0c;是容器内目录与宿主机目录之间映射的桥梁。 对数据卷的修改会立马生效数据卷可以在容器之间共享和重用对数据卷的更新&#xff0c;不会影响镜像数据卷默认会一直存在&#xf…

Element UI:初步探索 Vue.js 的高效 UI 框架

Element UI&#xff1a;初步探索 Vue.js 的高效 UI 框架 一 . ElementUI 基本使用1.1 Element 介绍1.2 Element 快速入门1.3 基础布局1.4 容器布局1.5 表单组件1.6 表格组件1.6.1 基础表格1.6.2 带斑马纹表格1.6.3 带边框表格1.6.4 带状态的表格 1.7 导航栏组件讲解 二 . 学生列…

动态规划(一)——斐波那契数列模型

文章目录 斐波那契数列模型第N个泰波那契数 补充&#xff1a;空间优化——滚动数组三步问题最小花费爬楼梯解码方法 斐波那契数列模型 回头总结&#xff1a; 斐波那契数列模型一般都是线性dp&#xff0c;对于这类DP题目的状态表示一般是 以i为结尾&#xff0c;… 分析状态转移方…