(7) cmake 编译C++程序(二)

news2024/9/21 5:18:56

文章目录

    • 概要
    • 整体代码结构
    • 整体代码
    • 小结

概要

在ubuntu下,通过cmake编译一个稍微复杂的管理程序

整体代码结构

在这里插入图片描述

整体代码

boss.cpp

#include "boss.h"

Boss::Boss(int id, string name, int dId)
{
	this->Id = id;
	this->Name = name;
	this->DeptId = dId;

}

void Boss::showInfo()
{
	cout << "职工编号: " << this->Id
		<< " \t职工姓名: " << this->Name
		<< " \t岗位:" << this->getDeptName()
		<< " \t岗位职责:管理公司所有事务" << endl;
}

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

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.cpp

#include "employee.h"

Employee::Employee(int id, string name, int dId)
{
	this->Id = id;
	this->Name = name;
	this->DeptId = dId;
}

void Employee::showInfo()
{
	cout << "职工编号: " << this->Id
		<< " \t职工姓名: " << this->Name
		<< " \t岗位:" << this->getDeptName()
		<< " \t岗位职责:完成经理交给的任务" << endl;
}


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

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.cpp

#include "manager.h"

Manager::Manager(int id, string name, int dId)
{
	this->Id = id;
	this->Name = name;
	this->DeptId = dId;

}

void Manager::showInfo()
{
	cout << "职工编号: " << this->Id
		<< " \t职工姓名: " << this->Name
		<< " \t岗位:" << this->getDeptName()
		<< " \t岗位职责:完成老板交给的任务,并下发任务给员工" << endl;
}

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

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();
};

worker.h

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

//职工抽象基类
class Worker
{
public:

	//显示个人信息
	virtual void showInfo() = 0;
	//获取岗位名称
	virtual string getDeptName() = 0;

	int Id; //职工编号
	string Name; //职工姓名
	int DeptId; //职工所在部门名称编号
};

workerManager.cpp

#include "workerManager.h"

workerManager::workerManager()
{
	ifstream ifs;
	ifs.open(FILENAME, ios::in);

	//文件不存在情况
	if (!ifs.is_open())
	{
		cout << "文件不存在" << endl; //测试输出
		this->work_num = 0;  //初始化人数
		this->fileIsEmpty = true; //初始化文件为空标志
		ifs.close(); //关闭文件
		return;
	}

	char ch;
	ifs >> ch;
	if (ifs.eof())
	{
		cout << "文件为空!" << endl;
		this->work_num = 0;
		this->fileIsEmpty = true;
		ifs.close();
		return;
	}

	int num =  this->get_Num();
	this->work_num = num;  //更新成员属性

	init_Emp(); 
	for (int i = 0; i < this->work_num; i++)
	{
		cout << "职工号: " << this->works[i]->Id
			<< " 职工姓名: " << this->works[i]->Name
			<< " 部门编号: " << this->works[i]->DeptId << endl;
	}
}

workerManager::~workerManager()
{
	for (vector<Worker *>::iterator it = this->works.begin(); it != this->works.end(); it ++) 
    if (NULL != *it) 
    {
        delete *it; 
        *it = NULL;
    }
	this->works.clear();

}

void workerManager::Show_Menu()
{
	cout << "********************************************" << endl;
	cout << "*********  欢迎使用职工管理系统! **********" << endl;
	cout << "*************  0.退出管理程序  *************" << endl;
	cout << "*************  1.增加职工信息  *************" << endl;
	cout << "*************  2.显示职工信息  *************" << endl;
	cout << "*************  3.删除离职职工  *************" << endl;
	cout << "*************  4.修改职工信息  *************" << endl;
	cout << "*************  5.查找职工信息  *************" << endl;
	cout << "*************  6.按照编号排序  *************" << endl;
	cout << "*************  7.清空所有文档  *************" << endl;
	cout << "********************************************" << endl;
	cout << endl;
}

void workerManager::exitSystem()
{
	cout << "欢迎下次使用" << endl;
    cin.ignore();
	cin.get();
    system("clear");
	exit(0);
}

void workerManager::Add_Emp()
{
	cout << "请输入增加职工数量: " << endl;

	int addNum = 0;
	cin >> addNum;

	if (addNum > 0)
	{	
		int new_size = this->work_num + addNum;
		this->works.reserve(new_size);

		//输入新数据
		for (int i = 0; i < addNum; i++)
		{
			int id;
			string name;
			int dSelect;

			cout << "请输入第 " << i + 1 << " 个新职工编号:" << endl;
			cin >> id;

			cout << "请输入第 " << i + 1 << " 个新职工姓名:" << endl;
			cin >> name;


			cout << "请选择该职工的岗位:" << endl;
			cout << "1、普通职工" << endl;
			cout << "2、经理" << endl;
			cout << "3、老板" << 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;
			}


			this->works.push_back(worker);
		}

		this->work_num = new_size;
		this->fileIsEmpty = false;
		//提示信息
		cout << "成功添加" << addNum << "名新职工!" << endl;
		this->save();
	}
	else
	{
		cout << "输入有误" << endl;
	}

	std::cout << "Press Enter to continue...";
    cin.ignore();
	cin.get();
    system("clear");
}

void workerManager::save()
{
	ofstream ofs;
	ofs.open(FILENAME, ios::out);
	for (int i = 0; i < this->work_num; i++)
	{
		ofs << this->works[i]->Id << " " 
			<< this->works[i]->Name << " " 
			<< this->works[i]->DeptId << endl;
	}

	ofs.close();
}


int workerManager::get_Num()
{
	ifstream ifs;
	ifs.open(FILENAME, ios::in);
	string line;

	int num = 0;

	while (getline(ifs, line)) { // 逐行读取文件内容
		if(line.empty()){
			continue;
		}
		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;
		if (dId == 1)  // 1普通员工
		{
			worker = new Employee(id, name, dId);
		}
		else if (dId == 2) //2经理
		{
			worker = new Manager(id, name, dId);
		}
		else //总裁
		{
			worker = new Boss(id, name, dId);
		}
		// //存放在数组中
		works.push_back(worker);
		index++;
	}
}


void workerManager::Show_Emp()
{
	system("clear");
	if (this->fileIsEmpty)
	{
		cout << "文件不存在或记录为空!" << endl;
	}
	else
	{
		for (int i = 0; i < this->work_num; i++)
		{
			//利用多态调用接口
			this->works[i]->showInfo();
		}
	}

	std::cout << "Press Enter to continue...";
    cin.ignore();
	cin.get();
    system("clear");
}

int workerManager::IsExist(int id)
{
	int index = -1;

	for (int i = 0; i < this->work_num; i++)
	{
		if (this->works[i]->Id == id)
		{
			index = i;

			break;
		}
	}

	return index;
}

void workerManager::Del_Emp()
{
	system("clear");
	if (this->fileIsEmpty)
	{
		cout << "文件不存在或记录为空!" << endl;
	}
	else
	{
		//按职工编号删除
		cout << "请输入想要删除的职工号:" << endl;
		int id = 0;
		cin >> id;

		int index = this->IsExist(id);

		if (index != -1)  //说明index上位置数据需要删除
		{
			for (int i = index; i < this->work_num - 1; i++)
			{
				this->works[i] = this->works[i + 1];
			}
			this->work_num--;

			this->save(); //删除后数据同步到文件中
			cout << "删除成功!" << endl;
		}
		else
		{
			cout << "删除失败,未找到该职工" << endl;
		}
	}
	
	std::cout << "Press Enter to continue...";
    cin.ignore();
	cin.get();
    system("clear");
}

void workerManager::Mod_Emp()
{
	if (this->fileIsEmpty)
	{
		cout << "文件不存在或记录为空!" << endl;
	}
	else
	{
		cout << "请输入修改职工的编号:" << endl;
		int id;
		cin >> id;

		int ret = this->IsExist(id);
		if (ret != -1)
		{ 
			//查找到编号的职工
			int newId = 0;
			string newName = "";
			int dSelect = 0;

			cout << "查到: " << id << "号职工,请输入新职工号: " << endl;
			cin >> newId;

			cout << "请输入新姓名: " << endl;
			cin >> newName;

			cout << "请输入岗位: " << endl;
			cout << "1、普通职工" << endl;
			cout << "2、经理" << endl;
			cout << "3、老板" << endl;
			cin >> dSelect;

			this->works[ret]->Id = newId;
			this->works[ret]->Name = newName;
			this->works[ret]->DeptId = dSelect;
			
			cout << "修改成功!" << endl;

			//保存到文件中
			this->save();
		}
		else
		{
			cout << "修改失败,查无此人" << endl;
		}
	}

	std::cout << "Press Enter to continue...";
    cin.ignore();
	cin.get();
    system("clear");
}

void workerManager::Find_Emp()
{
	if (this->fileIsEmpty)
	{
		cout << "文件不存在或记录为空!" << endl;
	}
	else
	{
		cout << "请输入查找的方式:" << endl;
		cout << "1、按职工编号查找" << endl;
		cout << "2、按姓名查找" << endl;

		int select = 0;
		cin >> select;


		if (select == 1) //按职工号查找
		{
			int id;
			cout << "请输入查找的职工编号:" << endl;
			cin >> id;

			int ret = IsExist(id);
			if (ret != -1)
			{
				cout << "查找成功!该职工信息如下:" << endl;
				this->works[ret]->showInfo();
			}
			else
			{
				cout << "查找失败,查无此人" << endl;
			}
		}
		else if(select == 2) //按姓名查找
		{
			string name;
			cout << "请输入查找的姓名:" << endl;
			cin >> name;

			bool flag = false;  //查找到的标志
			for (int i = 0; i < this->work_num; i++)
			{
				if (works[i]->Name == name)
				{
					cout << "查找成功,职工编号为:"
						<< works[i]->Id
						<< " 号的信息如下:" << endl;
					
					flag = true;

					this->works[i]->showInfo();
				}
			}
			if (flag == false)
			{
				//查无此人
				cout << "查找失败,查无此人" << endl;
			}
		}
		else
		{
			cout << "输入选项有误" << endl;
		}
	}


	std::cout << "Press Enter to continue...";
    cin.ignore();
	cin.get();
    system("clear");
}


void workerManager::Sort_Emp()
{
	if (this->fileIsEmpty)
	{
		cout << "文件不存在或记录为空!" << endl;
		std::cout << "Press Enter to continue...";
		cin.ignore();
		cin.get();
		system("clear");
	}
	else
	{
		cout << "请选择排序方式: " << endl;
		cout << "1、按职工号进行升序" << endl;
		cout << "2、按职工号进行降序" << endl;

		int select = 0;
		cin >> select;


		for (int i = 0; i < this->work_num; i++)
		{
			int minOrMax = i;
			for (int j = i + 1; j < this->work_num; j++)
			{
				if (select == 1) //升序
				{
					if (this->works[minOrMax]->Id > this->works[j]->Id)
					{
						minOrMax = j;
					}
				}
				else  //降序
				{
					if (this->works[minOrMax]->Id < this->works[j]->Id)
					{
						minOrMax = j;
					}
				}
			}

			if (i != minOrMax)
			{
				Worker * temp = this->works[i];
				this->works[i] = this->works[minOrMax];
				this->works[minOrMax] = temp;
			}

		}

		cout << "排序成功,排序后结果为:" << endl;
		this->save();
		this->Show_Emp();
	}

}

void workerManager::Clean_File()
{
	cout << "确认清空?" << endl;
	cout << "1、确认" << endl;
	cout << "2、返回" << endl;

	int select = 0;
	cin >> select;

	if (select == 1)
	{
		//打开模式 ios::trunc 如果存在删除文件并重新创建
		ofstream ofs(FILENAME, ios::trunc);
		ofs.close();

		if (this->works.size() > 0)
		{
            for (int i = 0; i < this->works.size(); i++)
			{
				if (this->works[i] != NULL)
				{
					delete this->works[i];
				}
			}
			this->work_num = 0;
			this->fileIsEmpty = true;
		}
		cout << "清空成功!" << endl;
	}

	std::cout << "Press Enter to continue...";
    cin.ignore();
	cin.get();
    system("clear");
}

workerManager.h

#pragma once
#include<iostream>
#include<vector>
#include <fstream>
#include "worker.h"
#include "employee.h"
#include "manager.h"
#include "boss.h"
using namespace std;

#define  FILENAME "empFile.txt"

class workerManager
{
private:
    int work_num = 0;
    bool fileIsEmpty;
    vector<Worker*> works;

public:
    workerManager();

    void Show_Menu();

    int get_Num();

    void exitSystem();

    void Add_Emp();

    void init_Emp();

    void Show_Emp();

    void Del_Emp();

    void Mod_Emp();

    void Find_Emp();

    void Sort_Emp();

    void Clean_File();

    int IsExist(int id);

    void save();
    
    ~workerManager();
};

main.cpp

#include <iostream>
#include <string>
#include <unistd.h>
using namespace std;

#include "src/workerManager.h"
#include "src/worker.h"
#include "src/employee.h"
#include "src/manager.h"
#include "src/boss.h"

void test()
{
	Worker * worker = NULL;
	worker = new Employee(1, "张三", 1);
	worker->showInfo();
	delete worker;
	
	worker = new Manager(2, "李四", 2);
	worker->showInfo();
	delete worker;

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


int main(){
	// test();
    workerManager wm;
	int choice = 0;
	while (true)
	{
		//展示菜单
		wm.Show_Menu();
		cout << "请输入您的选择:" << endl;
		cin >> choice;

		switch (choice)
		{
		case 0: //退出系统
			wm.exitSystem();
			break;
		case 1: //添加职工
			wm.Add_Emp();
			break;
		case 2: //显示职工
			wm.Show_Emp();
			break;
		case 3: //删除职工
			wm.Del_Emp();
			break;
		case 4: //修改职工
			wm.Mod_Emp();
			break;
		case 5: //查找职工
			wm.Find_Emp();
			break;
		case 6: //排序职工
			wm.Sort_Emp();
			break;
		case 7: //清空文件
			wm.Clean_File();
			break;
		default:
			system("clear");
			break;
		}
	}

	std::cout << "Press Enter to continue...";
    cin.ignore();
	cin.get();
    system("clear");

	return 0;

}

CMakeLists.txt

cmake_minimum_required(VERSION 2.6) # cmake最低版本
project(manager_project) #项目名称
set(CMAKE_CXX_STANDARD 11) #设置C++编译版本
set(CMAKE_BUILD_TYPE "Debug") # 默认是Release模式,设置为Debug才能调试

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) #设置可执行文件生产的路径
file(GLOB SOURCES "${PROJECT_SOURCE_DIR}/src/*.cpp")

aux_source_directory(. SRC_LISTS) #.下所有的cpp文件打包到变量SRC_LISTS中
add_executable(demo ${SOURCES} ${SRC_LISTS}) #生成可执行文件demo

run.sh

#!/bin/bash

mkdir -p build
cd build
cmake ..
make
cd ../bin
./demo

小结

好像还有点小bug没调试,整体应该是能运行

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

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

相关文章

error C2011: “sockaddr_in”:“struct”类型重定义的修改办法

问题 windows.h和winsock2.h存在有类型重定义,往往体现在头文件包含winsock2.h和windows.h时出现编译错误: error C2011: “sockaddr_in”:“struct”类型重定义 2>D:\Windows Kits\10\Include\10.0.22000.0\shared\ws2def.h(442,5): error C2143: 语法错误: 缺少“}”(…

为什么大家都想学大模型?一文揭秘!

小编只是普通的汽车软件工程师&#xff0c;想了解人工智能&#xff0c;又感觉好遥远&#xff0c;仔细的看了半天&#xff0c;就一个想法 好好拥抱AI吧。真的好强。 相比之下&#xff0c;Autosar 是个 der 啊。。。。 人工智能基础概念全景图 AI -> 机器学习 机器学习 ->…

探索 Python 的新视界:ttkbootstrap 库

探索 Python 的新视界&#xff1a;ttkbootstrap 库 背景与简介 在 Python 的世界中&#xff0c;库的丰富性是其强大功能的重要体现之一。今天&#xff0c;我们将一起探索一个令人兴奋的库——ttkbootstrap。这个库不仅提供了丰富的界面组件&#xff0c;还使得界面设计变得简单…

Python脚本批量下载ECWMF免费数据教程

前情提要 最近需要使用EC的一些数据&#xff0c;摸索下载过程中顺便记录下来&#xff0c;综合了EC上免费数据集的两个数据集的下载方式&#xff0c;使用python脚本下载 相比在网站上操作下载&#xff0c;个人更推荐脚本下载&#xff0c;官方已经封装好了两个库直接可以方便使…

HTML5实现好看的天气预报网站源码

文章目录 1.设计来源1.1 获取天气接口1.2 PC端页面设计1.3 手机端页面设计 2.效果和源码2.1 动态效果2.2 源代码 源码下载万套模板&#xff0c;程序开发&#xff0c;在线开发&#xff0c;在线沟通 作者&#xff1a;xcLeigh 文章地址&#xff1a;https://blog.csdn.net/weixin_4…

Django+vue自动化测试平台(27)-- 封装websocket测试

websocket概述&#xff1a; WebSocket 是一种在单个 TCP 连接上进行全双工通信(Full Duplex 是通讯传输的一个术语。通信允许数 据在两个方向上同时传输&#xff0c;它在能力上相当于两个单工通信方式的结合。全双工指可以同时&#xff08;瞬时&#xff09;进 行信号的双向传输…

Linux第四节课(指令与权限)

1、date指令(时间) 程序运行到自己的每一个关键时刻&#xff0c;都要自己打日志&#xff01; 日志包括时间、日志等级、日志具体信息、其他信息等&#xff0c;然后按照行为单位写入文件中&#xff0c;这个文件被称为日志文件&#xff01; 在日志文件中筛选信息时&#xff0c…

idea springBoot启动时覆盖apollo配置中心的参数

vm options -Dorder.stat.corn“0/1 * * * * ?” 只有vm options, -D参数才能覆盖apollo参数 program arguments –key01val01 --key02val02 environment varibales envFAT;key02val02;key03val03

视觉巡线小车——STM32+OpenMV(四)

目录 前言 一、整体控制思路 二、代码实现 1.主函数 2.定时器回调函数 总结 前言 通过以上三篇文章已将基本条件实现&#xff0c;本文将结合以上内容&#xff0c;进行综合控制&#xff0c;实现小车的视觉巡线功能。 系列文章请查看&#xff1a;视觉巡线小车——STM32OpenMV系列…

BUUCTF [WUSTCTF2020]朴实无华

首先进来不知道要干啥&#xff0c;上dirsearch扫出个机器人协议&#xff0c;一看有点东西 直接访问很明显这不是flag 主页面看他说什么不能修改头部&#xff0c;看一下数据包 发现了好东西 看到源码&#xff0c;又得绕过了。不过这编码有点问题导致乱码了 找个在线网站稍微恢复…

QtQuick-第一个程序

新建Qt Quick Application。 main.cpp(保持原有的即可): #include <QGuiApplication> #include <QQmlApplicationEngine>int main (int argc, char *argv[]) {QGuiApplication app (argc, argv);QQmlApplicationEngine engine;const QUrl url (QStringLiteral (&…

南平建网站公司推荐 好用的b2b独立站模板

床品毛巾wordpress独立站模板 床单、被套、毛巾、抱枕、靠垫、围巾、布艺、枕头、乳胶枕、四件套、浴巾wordpress网站模板。 https://www.jianzhanpress.com/?p4065 打印耗材wordpress自建独立站模板 色带、墨盒、碳粉、打印纸、硒鼓、墨盒、墨水、3D打印机、喷头wordpress…

基于 Apache 的 httpd 文件服务器

基于 Apache 的 httpd 文件服务器 文件服务器的简介 httpd&#xff08;HTTP Daemon&#xff0c;超文本传输协议守护进程的简称&#xff09;&#xff0c;运行于网页服务器后台&#xff0c;等待传入服务器请求的软件。 httpd 能够自动回应服务器的请求&#xff0c;并使用 http…

<PLC><Python>使用python与汇川PLC基于socket通讯程序:传感器数据传送与监控

前言 本系列是关于PLC相关的博文,包括PLC编程、PLC与上位机通讯、PLC与下位驱动、仪器仪表等通讯、PLC指令解析等相关内容。 PLC品牌包括但不限于西门子、三菱等国外品牌,汇川、信捷等国内品牌。 除了PLC为主要内容外,PLC相关元器件如触摸屏(HMI)、交换机等工控产品,如…

一文读懂英伟达A800的性能及应用场景

随着人工智能&#xff08;AI&#xff09;和高性能计算&#xff08;HPC&#xff09;领域的快速发展&#xff0c;对处理器的性能要求日益提高。英伟达&#xff08;NVIDIA&#xff09;作为全球领先的图形处理器&#xff08;GPU&#xff09;和人工智能技术公司&#xff0c;不断推出…

【C++】C++类和对象详解(上)

目录 思维导图大纲&#xff1a; 思维方面&#xff1a; 1. 类的定义&#xff1a; 2. 类的特点&#xff1a; 3. this指针&#xff1a; 4. 类的默认成员函数 默认构造函数 1.构造函数 2.析构函数 3.拷贝构造函数 4. 赋值运算符重载 1. 运算符重载 5. 日期类实现&#…

abc363+cf960div.2+牛客周赛49轮

C - Avoid K Palindrome 2 (atcoder.jp) 思路&#xff1a; 罗列出排列的每一种情况&#xff0c;再根据题目要求进行判断 代码&#xff1a; void solve() {ll n, k;cin >> n >> k;string s;vector<char>a;cin >> s;for (int i 0; i < n; i)a.pus…

在Windows安装、部署Tomcat的方法

本文介绍在Windows操作系统中&#xff0c;下载、配置Tomcat的方法。 Tomcat是一个开源的Servlet容器&#xff0c;由Apache软件基金会的Jakarta项目开发和维护&#xff1b;其提供了执行Servlet和Java Server Pages&#xff08;JSP&#xff09;所需的所有功能。其中&#xff0c;S…

hcip报名费用多少?该如何备考hcip?

现在很多行业都比较萧条&#xff0c;但是有个行业正是热门的时候&#xff0c;那就是网络领域&#xff0c;那么想进入这个领域&#xff0c;肯定知道hcip是什么&#xff0c;那么小编就针对几个常常被问到两个话题&#xff0c;hcip报名费用多少?该如何备考hcip?给大家好好聊聊其…

JavaScript进阶之深入面向对象

目录 深入面向对象一、编程思想1.1 面向过程1.2 面向对象&#xff08;oop&#xff09; 二、构造函数三、原型3.1 原型3.2 constructor属性3.3 对象原型3.4 原型继承3.5 原型链 深入面向对象 一、编程思想 1.1 面向过程 面向过程是分析解决问题所需要的步骤&#xff0c;用函数…