CPP
shatule
wanna better, give your best
展开
-
c/c++遍历文件
1.遍历指定文件夹下文件#include<io.h>#include <iostream>#include<string>using namespace std;void file_search(string path, int layer){ //struct _finddata_t 是用来存储文件各种信息的结构体 struct _finddata_t filefind; //当前文件夹 string curr = pat原创 2021-08-30 15:49:59 · 834 阅读 · 0 评论 -
c/c++ 写文件处理
1.c写文件FILE *fopen( const char * filename, const char * mode );#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>int main(){ FILE* fp = NULL; fp = fopen("test.txt", "w+"); fprintf(fp, "This is testing for fprintf...\n"); fputs("Thi原创 2021-08-30 14:55:55 · 143 阅读 · 0 评论 -
c/c++ char类型字符串的操作
使用跨平台sprintf将float小数转为char字符串float score = 0.932061;char s[16];sprintf(s,"%f",score);cout << s[2] << endl ; // 输出9原创 2021-08-25 15:29:51 · 1845 阅读 · 0 评论 -
数据结构-学习
数据结构本文档资料参考leetcode和拉勾教育里的<300分钟搞定数据结构与算法>课程, 欢迎大家学习如涉及侵权, 请及时联系常用数据结构数组\字符串 Array & String链表 Linked-list栈 Stack队列 Queue双端队列 Deque树 Tree数组\字符串[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-j2SfuU4S-1614745156437)(dataStructureAndCpp.assets原创 2021-03-03 12:25:18 · 493 阅读 · 0 评论 -
C++ 之 链表
链表 单链表和双链表链表的特点是只能从头开始访问struct ListNode{ double value; ListNode *next;};链表修改和遍历 //声明链表 ListNode* head; ListNode* new_head; head = new ListNode; head->value = 1; head->next = nullptr; ListNode *secondPtr = new ListNode; secondPtr->v原创 2020-08-16 11:42:30 · 100 阅读 · 0 评论 -
c++ 之 堆栈
#include <stack>using namespace std;栈的基本操作top():返回一个栈顶元素的引用,类型为 T&。如果栈为空,返回值未定义。push(const T& obj):可以将对象副本压入栈顶。这是通过调用底层容器的 push_back() 函数完成的。push(T&& obj):以移动对象的方式将对象压入栈顶。这是通过调用底层容器的有右值引用参数的 push_back() 函数完成的。pop():弹出栈顶元素。siz原创 2020-08-15 23:20:54 · 220 阅读 · 0 评论 -
C++ 之 ubuntu环境 opencv读视频流
一.ubuntu环境下配置 opencv, 通过opencv源码编译安装(参考其他)二.准备以下2个文件cv.cpp 内容如下 #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/core/core.hpp> using namespace cv;原创 2020-08-14 18:03:39 · 540 阅读 · 0 评论 -
c++ 之 字典 map
map 是 关联容器,提供一对一的hash#include < map > #include < unordered_map > unordered_map<int, int>hashmap; hashmap[i] = i + 1;//创建一个mapmap<int, string> mapStudent;//插入元素// 定义一个map对象map<int, string> mapStudent; // 第一种 用insert原创 2020-08-13 22:58:10 · 1008 阅读 · 0 评论 -
C++ 之 向量 vector
C++ 之 向量 vector向量 vector :对象实体/容器//用的时候需要包含#include <vector> 一维向量和二维向量都可//一维向量创建与使用vector<int> vec; //声明向量 vector<int> vec(10) ; //声明一个初始大小为10的向量 vector<int> vec(10, 1) ;//声明一个初始大小为10且初始值都为1的向量 vector<int> bvec(vec)原创 2020-08-13 22:50:09 · 223 阅读 · 0 评论