摘要: 打开文件关闭文件 文件分为:二进制(dat)和文本文件(txt); 代码: #include<stdio.h> #include<stdlib.h> { FILE *fp; if ((fp=fopen("地址&名字","方式"))==NULL) { printf("cannot open file\ 阅读全文
posted @ 2022-05-09 18:48 xxj112 阅读(48) 评论(0) 推荐(0)
摘要: 原理: 都是基于二分查找。 升序数组中: lower_bound( begin,end,num):返回(begin和end之间)第一个大于或等于num的数字的地址。 下标=返回地址-begin; upper_bound(begin,end,num) : (同上) 唯一不同——返回第一个大于num的数 阅读全文
posted @ 2022-05-09 17:55 xxj112 阅读(47) 评论(0) 推荐(0)
摘要: fill 在头文件<algorithm>里。 按照数组的始末位置以一个数组元素为单位赋值,将区间内的每一个元素都赋值为val。 代码:fill(vector.begin(), vector.end(), val); fill_n() 在头文件<algorithm>里。 从当前起始点开始,将之后的cn 阅读全文
posted @ 2022-05-09 17:40 xxj112 阅读(100) 评论(0) 推荐(0)
摘要: #include<iostream> #include<queue> #include<vector> using namespace std; typedef pair<int,int> pll; int main() { priority_queue<pll,vector<pll>,less<p 阅读全文
posted @ 2022-05-09 17:22 xxj112 阅读(27) 评论(0) 推荐(0)