当前位置: 首页 > news >正文

做旅游网站的设计感想/企业网站设计要求

做旅游网站的设计感想,企业网站设计要求,毕业设计做的网站代码会查重,58同城石家庄网站建设0.前言 1.find #include <iostream> using namespace std;// 常用查找算法 find #include<vector> #include<algorithm>//查找 内置数据类型 void test01() {vector<int>v;for (int i 0; i < 10; i){v.push_back(i);}//查找 容器中 是否有 5 这个元…

0.前言

在这里插入图片描述

1.find

在这里插入图片描述
在这里插入图片描述

#include <iostream>
using namespace std;// 常用查找算法 find
#include<vector>
#include<algorithm>//查找 内置数据类型
void test01()
{vector<int>v;for (int i = 0; i < 10; i++){v.push_back(i);}//查找 容器中 是否有 5 这个元素vector<int>::iterator it = find(v.begin(), v.end(), 5); // 返回迭代器类型 if (it == v.end()){cout << "没找到" << endl;}else{cout << "找到: " << *it << endl;}
}//查找 自定义数据类型class Person
{
public:Person(string name, int age){this->m_Name = name;this->m_Age = age;}//重载 == 让底层find知道如何对比person数据类型bool operator==(const Person&p) //加const 防止修改数据{if (p.m_Name == this->m_Name && p.m_Age == this->m_Age){return true;}else{return false;}}string m_Name;int m_Age;
};void test02()
{//创建数据Person p1("a", 10);Person p2("b", 20);Person p3("c", 30);//放入容器中vector<Person>v;v.push_back(p1);v.push_back(p2);v.push_back(p3);Person p5("b", 20);vector<Person>::iterator it = find(v.begin(), v.end(), p5);if (it == v.end()){cout << "未找到" << endl;}else{cout << "找到: 姓名: " << it->m_Name << "  age:" << (*it).m_Age << endl;}
}int main()
{test01();cout << "------------------------" << endl;test02();//cout << "------------------------" << endl << endl;//test03();//**************************************system("pause");return 0;
} 

在这里插入图片描述

2.find_if

在这里插入图片描述

#include <iostream>
using namespace std;// 常用查找算法 find_if
#include<vector>//1.查找内置数据类型class Greater5
{
public:bool operator()(int val){return val > 5;}
};void test01()
{vector<int>v;for (int i = 0; i < 10; i++){v.push_back(i);}vector<int>::iterator it = find_if(v.begin(), v.end(), Greater5());if (it == v.end()){cout << "no find" << endl;}else{cout << "find element: " << (*it) << endl;}
}//2、查找自定义数据类型class Person
{
public:Person(string name, int age){this->m_Name = name;this->m_Age = age;}string m_Name;int m_Age;
};//方式一 利用仿函数
//class greater_Age20
//{
//public:
//	bool operator()(const Person& p)
//	{
//		return p.m_Age > 20;
//	}
//};//方式二 利用普通函数
bool greater_Age20(const Person& p)
{return p.m_Age > 20;
}void test02()
{//创建对象Person p1("a", 10);Person p2("b", 20);Person p3("c", 30);vector<Person>v;v.push_back(p1);v.push_back(p2);v.push_back(p3);//查找年龄大于20的人vector<Person>::iterator it = find_if(v.begin(), v.end(), greater_Age20);if (it == v.end()){cout << "no find" << endl;}else{cout << "find the element: name:" << it->m_Name << " age:" << it->m_Age << endl;}
}int main()
{test01();cout << "------------------------" << endl;test02();//cout << "------------------------" << endl << endl;//test03();//**************************************system("pause");return 0;
} 

在这里插入图片描述

3.adjacent_find

在这里插入图片描述
在这里插入图片描述

#include <iostream>
using namespace std;// 常用查找算法 adjacent_find
#include<vector>
#include<algorithm>void test01()
{//创建对象vector<int>v;v.push_back(1);v.push_back(2);v.push_back(1);v.push_back(3);v.push_back(4);v.push_back(3);v.push_back(3);vector<int>::iterator pos = adjacent_find(v.begin(), v.end());if (pos == v.end()){cout << "no find adjacent duplcate elements " << endl;}else{cout << "find adjacent duplcate elements: " << *pos << endl;}
}int main()
{test01();cout << "------------------------" << endl;//test02();//cout << "------------------------" << endl << endl;//test03();//**************************************system("pause");return 0;
} 

在这里插入图片描述

4.binary_search

在这里插入图片描述
在这里插入图片描述

#include <iostream>
using namespace std;// 常用查找算法 binary_search 二分查找
#include<vector>
#include<algorithm>void test01()
{vector<int>v;for (int i = 0; i < 10; i++){v.push_back(i);}//v.push_back(2);  如果是无序序列,结果未知!//查找容器中是否有9元素//注意:容器必须是有序的序列(从小到大)bool ret = binary_search(v.begin(), v.end(),9);if (ret){cout << "find point element" << endl;}else{cout << "no find" << endl;}
}int main()
{test01();cout << "------------------------" << endl;//test02();//cout << "------------------------" << endl << endl;//test03();//**************************************system("pause");return 0;
} 

在这里插入图片描述

5.count

在这里插入图片描述
在这里插入图片描述

#include <iostream>
using namespace std;// 常用查找算法 count
#include<vector>
#include<algorithm>//1.统计内置数据类型
void test01()
{vector<int>v;v.push_back(1);v.push_back(4);v.push_back(1);v.push_back(3);int num = count(v.begin(), v.end(), 1);cout << "the nmber of point element: " << num << endl;
}//2.统计自定义数据类型
class Person
{
public:Person(string name, int age){this->m_Name = name;this->m_Age = age;}bool operator==(const Person& p){if (p.m_Age == this->m_Age){return true;}else{return false;}}string m_Name;int m_Age;
};
void test02()
{//创建对象Person p1("刘备", 35);Person p2("薇恩", 24);Person p3("皮城", 35);Person p4("光辉", 40);vector<Person>v;v.push_back(p1);v.push_back(p2);v.push_back(p3);v.push_back(p4);Person p5("卡米尔", 35);int num = count(v.begin(), v.end(), p5);cout << "跟卡米尔同岁的人有多少个: " << num << endl;
}int main()
{test01();cout << "------------------------" << endl;//test02();//cout << "------------------------" << endl << endl;//test03();//**************************************system("pause");return 0;
} 

在这里插入图片描述

6.count_if

在这里插入图片描述

#include <iostream>
using namespace std;// 常用查找算法 count_if
#include<vector>
#include<algorithm>//1、统计内置数据类型//利用仿函数
class Greater3
{
public:bool operator()(int val){return val > 3;}
};void test01()
{vector<int>v;v.push_back(1);v.push_back(6);v.push_back(3);v.push_back(2);v.push_back(4);v.push_back(3);int num = count_if(v.begin(), v.end(), Greater3());cout << "the number of element greater than 3 :  " << num << endl;
}//2、统计自定义数据类型class Person
{
public:Person(string name, int age){this->m_Name = name;this->m_Age = age;}string m_Name;int m_Age;
};//利用普通函数
bool age_Greater35(const Person& p)
{if (p.m_Age > 35){return true;}else{return false;}
}void test02()
{//创建对象Person p1("刘备", 35);Person p2("薇恩", 24);Person p3("皮城", 35);Person p4("光辉", 40);vector<Person>v;v.push_back(p1);v.push_back(p2);v.push_back(p3);v.push_back(p4);//统计岁数大于35的人物的个数int num = count_if(v.begin(), v.end(), age_Greater35);cout << "the number of character whose age greater than 35 :" << num << endl;
}int main()
{test01();cout << "------------------------" << endl;test02();//cout << "------------------------" << endl << endl;//test03();//**************************************system("pause");return 0;
} 

在这里插入图片描述

相关文章:

【C++】STL-常用算法-常用查找算法

0.前言 1.find #include <iostream> using namespace std;// 常用查找算法 find #include<vector> #include<algorithm>//查找 内置数据类型 void test01() {vector<int>v;for (int i 0; i < 10; i){v.push_back(i);}//查找 容器中 是否有 5 这个元…...

vue3 webpack打包流程及安装 (1)

npm run build 也可以打包 如果没有特殊需求 可以使用 效果其实是差不多的 --------------------------------------------------------------------------------------------------------------------------------- webpack网址 &#xff1a; 起步 | webpack 中文文档 (docsc…...

【C++】内联函数 ① ( 内联函数引入 | 内联函数语法 )

文章目录 一、内联函数引入1、内联函数引入2、代码示例 - 宏代码片段 与 内联函数 二、内联函数语法1、内联函数语法说明2、代码示例 - 内联函数基本语法 一、内联函数引入 1、内联函数引入 " 内联函数 " 是 C 语言中的一种特殊函数 , 其目的是为了提高程序的执行效率…...

聊聊springboot的ConfigurationProperties的绑定

序 本文主要研究一下springboot的ConfigurationProperties的绑定 ConfigurationPropertiesBindingPostProcessor org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java /*** {link BeanPostProcessor} to bind {link PropertySo…...

Mysql和Oracle的语法区别?

Mysql和Oracle是两种不同的关系型数据库。 MySQL通常在中小型应用程序、Web应用程序和小型企业中广泛使用&#xff0c;因为它易于学习和部署&#xff0c;而且成本较低。 Oracle数据库通常用于大型企业和复杂的企业级应用程序&#xff0c;因为它提供了高度可扩展性、高可用性…...

F - LIS on Tree

F - LIS on Tree (atcoder.jp) 问题描述&#xff1a;树上LIS。 普通LIS。O(n * n)。 void solve() {int n; cin>>n;vector<int> f(n 1),a(n1);for(int i 1; i < n; i) {cin>>a[i];f[i] 1;for(int j 1; j < i; j) {if(a[i] > a[j]) f[i] max…...

2023 年全国大学生数学建模B题目-多波束测线问题

B题目感觉属于平面几何和立体几何的问题&#xff0c;本质上需要推导几何变换情况&#xff0c;B题目属于有标准答案型&#xff0c;没太大的把握不建议选择&#xff0c;可发挥型不大。 第一问 比较简单&#xff0c;就一个2维平面的问题&#xff0c;但有点没理解&#xff0c;这个…...

qt creater11 翻译国际化教程教程:

先出效果图。 闲聊几句&#xff1a;qt这个翻译很方便&#xff0c;能直接导出项目里所有文字。 具体步骤如下&#xff1a; 在Qt中&#xff0c;我们可以使用QTranslator类来实现多语言切换。以下是一般步骤&#xff1a; 1. 在你的源代码中&#xff0c;所有需要翻译的字符串都…...

【AWS实验 】在 AWS Fargate 上使用 Amazon ECS 部署应用程序

文章目录 实验概览目标实验环境任务 1&#xff1a;连接到实验命令主机任务 2&#xff1a;将应用程序容器化任务 3&#xff1a;构建 Web2048 容器任务 4&#xff1a;创建 Amazon ECR 存储库并推送 Docker 映像任务 5&#xff1a;创建 ECS 集群任务 6&#xff1a;测试应用程序总结…...

matlab几种求解器的选择fsolve-sole-vpasolve

文章目录 fsolvesolvevpasovle总结vpasovle的结果fsovle的结果 fsolve 求数值解 result_xfsolve(my_fun,x0,options)参数: my_fun:待求解函数&#xff0c;作为一个.m文件 x0:初始值&#xff0c;向量&#xff0c;可以仅仅指定其中的几项solve 强大的求解器。在方程组中求解析…...

无限访问 GPT-4,OpenAI 强势推出 ChatGPT 企业版!

继 ChatGPT 收费大降价、推出 App 版等系列动作之后&#xff0c;OpenAI 于今日宣布正式发布面向企业的 AI 助手——ChatGPT Enterprise 版。 与 To C 端的 ChatGPT 版本有所不同的是&#xff0c;该版本可以以更快速度无限制地访问 GPT-4&#xff0c;还可以用来处理更长输入的上…...

MySQL的故事——Schema与数据类型优化

Schema与数据类型优化 一、选择优化的数据类型 更小的通常更好 应该尽量使用可以正确存储数据的最小类型&#xff0c;更小的数据类型通常更快&#xff0c;因为他们占用更少的磁盘&#xff0c;内存和CPU缓存&#xff0c;并且处理时需要的CPU周期更少 简单就好 更简单的数据类型…...

C++编译和链接

编译和链接 一、源代码的组织 头文件&#xff08;.h&#xff09;&#xff1a;#include头文件、函数的声明、结构体的声明、类的声明、模板的声明、内联函数、#define和const定义的常量等。 源文件&#xff08;.cpp&#xff09;&#xff1a;函数的定义、类的定义、模板具体化的…...

【CSDN技术】Markdown编辑器如何使用-csdn博客编写入门

Markdown编辑器如何使用-csdn博客编写入门 欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题&#xff0c;有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants 创建一个自…...

【docker】运行redis

拉取redis镜像 有多种选择&#xff1a; redis&#xff08;基础版&#xff09;redis/redis-stack&#xff08;包含redis stack server和RedisInsight&#xff09;redis/redis-stack-server&#xff08;仅包含redis stack server&#xff09; docker pull redis docker pull r…...

Paddle训练COCO-stuff数据集学习记录

COCO-stuff数据集 COCO-Stuff数据集对COCO数据集中全部164K图片做了像素级的标注。 80 thing classes, 91 stuff classes and 1 class ‘unlabeled’ 数据集下载 wget --directory-prefixdownloads http://images.cocodataset.org/zips/train2017.zip wget --directory-prefi…...

SpringBoot 框架学习

java 学习笔记指路 基础知识 Python转java补充知识 Java中常见的名词解释 前端 【黑马程序员pink老师前端】HTML 【黑马程序员pink老师前端】JavaScript基础大总结 【黑马程序员pink老师前端】JavaScript函数与作用域 【黑马程序员pink老师前端】JavaScript对象 数据库 【黑马程…...

java - lua - redis 完成商品库存的删减

java调用lua脚本完成对商品库存的管理 主页链接 微风轻吟挽歌的主页 如若有帮助请帮忙点赞 //lua脚本 获取到内存不够的商品StringBuilder sb new StringBuilder();//定义一个数组存储可能缺少库存的值sb.append(" local table {} ");//获取值sb.append(" …...

dbeaver离线安装clickhouse连接驱动

Clickhouse 数据库连接工具——DBeaver 主要介绍了Clickhouse 数据库连接工具——DBeaver相关的知识&#xff0c;希望对你有一定的参考价值。 Clickhouse 数据库连接工具——DBeaver 1.下载 DBeaver 和 连接驱动 https://dbeaver.io/files/dbeaver-ce-latest-x86_64-setup.…...

2024腾讯校招后端面试真题汇总及其解答(二)

11.如果同时有5个任务在10分钟之后提交,或者更多,那么如果是一个个从队列中拿数据,那么前一个任务会影响后续任务执行时间,说一下解决思路 你的问题是一个典型的并发处理问题。如果你的系统是单线程的,那么的确,前一个任务的执行时间会影响后续任务的执行时间。但是,你…...

datagrip 相关数据连接信息无缝迁移

背景 因为公司换电脑了&#xff0c;接触的项目比较多&#xff0c;不同项目&#xff0c;不同环境的数据库连接有好几十个&#xff0c;如果在新电脑上挨个重新连接一遍劳心劳力&#xff0c;所以想看一下能不能直接将之前保存的连接信息直接迁移到新的电脑上面。 为此&#xff0c…...

不就是G2O嘛

从零开始一起学习SLAM | 理解图优化&#xff0c;一步步带你看懂g2o代码 SLAM的后端一般分为两种处理方法&#xff0c;一种是以扩展卡尔曼滤波&#xff08;EKF&#xff09;为代表的滤波方法&#xff0c;一种是以图优化为代表的非线性优化方法。不过&#xff0c;目前SLAM研究的主…...

C#开发的OpenRA游戏之系统参数选项按钮

C#开发的OpenRA游戏之系统参数选项按钮 前面分析了信标按钮,从图上可以看到,靠右边的按钮,就是系统参数选项按钮: 这个按钮与前面三个按钮是不一样的,虽然它们在排列位置上是放在一起,但是处理的方法方式是不一样的,因为这个选项按钮,并不需要发命令给服务器,再返回来…...

苹果启动2024年SRDP计划:邀请安全专家使用定制iPhone寻找漏洞

苹果公司昨天&#xff08;8月30日&#xff09;正式宣布开始接受2024 年iPhone安全研究设备计划的申请&#xff0c;iOS 安全研究人员可以在 10 月底之前申请安全研究设备 SRD。 SRD设备是专门向安全研究人员提供的iPhone14Pro&#xff0c;该设备具有专为安全研究而设计的特殊硬…...

std::make_shared和new初始化智能指针的区别

先看代码&#xff1a; class Base {public:Base(int num):a(num) {std::cout << "Base() construct" << std::endl;}~Base() {std::cout << "Base() deconstruct" << std::endl;}int Get() {return a;}private:int a; };void tes…...

无涯教程-JavaScript - ERFC.PRECISE函数

描述 ERFC.PRECISE函数返回x和无穷大之间集成的互补ERF函数。 互补误差函数等于1-ERF(即1-误差函数),由等式给出- $$Erfc(x) \frac {2} {\sqrt {\pi}} \int_ {x} ^ {\infty} e ^ {-t ^ 2} dt $$ 语法 ERFC.PRECISE(x)争论 Argument描述Required/OptionalxThe lower bound…...

2023国赛数学建模C题思路分析 - 蔬菜类商品的自动定价与补货决策

# 1 赛题 在生鲜商超中&#xff0c;一般蔬菜类商品的保鲜期都比较短&#xff0c;且品相随销售时间的增加而变差&#xff0c; 大部分品种如当日未售出&#xff0c;隔日就无法再售。因此&#xff0c; 商超通常会根据各商品的历史销售和需 求情况每天进行补货。 由于商超销售的蔬菜…...

手写Spring:第1章-开篇介绍,手写Spring

文章目录 一、手写Spring二、Spring 生命周期 一、手写Spring &#x1f4a1; 目标&#xff1a;我们该对 Spring 学到什么程度&#xff1f;又该怎么学习呢&#xff1f; 手写简化版 Spring 框架&#xff0c;了解 Spring 核心原理&#xff0c;为后续再深入学习 Spring 打下基础。在…...

C语言中,字节对齐是一种重要的内存管理概念

C语言中&#xff0c;字节对齐是一种重要的内存管理概念 字节对齐的目的是为了提高内存访问的效率。因为CPU访问内存的最小单位是字节&#xff0c;所以如果数据结构的成员以正确的字节边界对齐&#xff0c;那么CPU就可以直接访问这些成员&#xff0c;而不需要进行额外的内存移动…...

网络丢包问题,敢不敢这样定位?

下午好&#xff0c;我的网工朋友。 所谓丢包&#xff0c;是指在网络数据的收发过程中&#xff0c;由于种种原因&#xff0c;数据包还没传输到应用程序中&#xff0c;就被丢弃了。 这些被丢弃包的数量&#xff0c;除以总的传输包数&#xff0c;也就是我们常说的丢包率。 丢包…...