![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
文章平均质量分 65
J-SC-30
这个作者很懒,什么都没留下…
展开
-
LinkedList实现类
LinkedList实现类原创 2014-10-26 14:50:05 · 304 阅读 · 0 评论 -
C++ tips
C++整理的小知识点 方便查阅和记忆原创 2015-07-24 15:55:38 · 407 阅读 · 0 评论 -
STL容器简单用例
STL原创 2015-08-13 09:39:24 · 704 阅读 · 0 评论 -
C++字符串string类提供的处理字符串的函数
C++字符串string类提供的处理字符串的函数原创 2015-08-13 21:42:21 · 418 阅读 · 0 评论 -
C++sort函数的用法
MSDN中的定义:template void sort(RanIt first, RanIt last); //--> 1) template void sort(RanIt first, RanIt last, Pred pr); //--> 2)头文件:#include using namespace std;1.默认的sort函数是按升序排。对应于1)原创 2015-06-08 21:23:51 · 421 阅读 · 0 评论 -
C语言itoa()函数和atoi()函数详解(整数转字符C实现)
C语言提供了几个标准库函数,可以将任意类型(整型、长整型、浮点型等)的数字转换为字符串。1.int/float to string/array:C语言提供了几个标准库函数,可以将任意类型(整型、长整型、浮点型等)的数字转换为字符串,下面列举了各函数的方法及其说明。● itoa():将整型值转换为字符串。● ltoa():将长整型值转换为字符串。● ultoa():将转载 2015-08-12 20:53:37 · 462 阅读 · 0 评论 -
C++ 中string.find() 函数的用法总结
string.find()函数用法原创 2015-07-16 12:50:31 · 825 阅读 · 0 评论 -
C++ next_permutation 穷举每一种组合
#include#includeusing namespace std;int a[10],n;void printArr(int a[], int arraySize);int main(){ cin>>n; for(int i = 0; i < n; i++) cin>>a[i]; sort(a, a+n); // 先排序 cout<原创 2015-08-05 16:26:47 · 488 阅读 · 0 评论 -
把数转换成length位的二进制字符串
#include#includeusing namespace std;templatestring binaryFormat(T val, int length){ //要转换成length位的二进制字符串 string binaryStr(length, '0'); for(int i = 0; i < length; i++){ if((val >>原创 2015-08-07 11:02:41 · 397 阅读 · 0 评论 -
C++ stringstream输入用法
stringstream原创 2015-07-28 14:32:10 · 2648 阅读 · 0 评论 -
C++STL中vector容器的用法
vector是C++标准模板库中的部分内容,它是一个多功能的,能够操作多种数据结构和算法的模板类和函数库。vector之所以被认为是一个容器,是因为它能够像容器一样存放各种类型的对象,简单地说vector是一个能够存放任意类型的动态数组,能够增加和压缩数据。为了可以使用vector,必须在你的头文件中包含下面的代码:#include vector属于std命名域的,因此需要通过命名转载 2015-06-13 11:27:09 · 344 阅读 · 0 评论 -
二叉树 BinaryTree.h
#ifndef BINARYTREE_H#define BINARYTREE_Htemplateclass TreeNode{public: T element; // Element contained in the node TreeNode * left; // Pointer to the left child TreeNode * right; // Pointer to the rig原创 2014-10-26 15:29:16 · 1142 阅读 · 0 评论 -
快速排序
// Function prototypesvoid quickSort(int list[], int arraySize);void quickSort(int list[], int first, int last);int partition(int list[], int first, int last);void quickSort(int list[], int array原创 2014-10-30 14:52:39 · 329 阅读 · 0 评论 -
堆 Heap.h
#ifndef HEAP_H#define HEAP_H#include #include using namespace std;templateclass Heap{public: Heap(); Heap(T elements[], int arraySize); T remove() throw (runtime_error); void add(T el原创 2014-10-28 14:51:20 · 367 阅读 · 0 评论 -
C语言中产生随机数
C语言/C++怎样产生随机数:这里要用到的是rand()函数, srand()函数,C语言/C++里没有自带的random(int number)函数。(1) 如果你只要产生随机数而不需要设定范围的话,你只要用rand()就可以了:rand()会返回一随机数值, 范围在0至RAND_MAX 间。RAND_MAX定义在stdlib.h, 其值为2147483647。例如:#includ转载 2015-03-27 17:48:05 · 630 阅读 · 0 评论 -
C字符串和C++字符串小结
在C中,并没有字符串这个数据类型,而是使用字符数组来保存字符串。C字符串实际上就是一个以null('\0')字符结尾的字符数组,null字符表示字符串的结束。需要注意的是:只有以null字符结尾的字符数组才是C字符串,否则只是一般的C字符数组。C字符串定义时可以利用"="号进行初始化,但是以后不能利用"="对C字符串进行赋值。对C字符串的操作需要通过"string"文件中定义的转载 2015-06-08 20:00:14 · 357 阅读 · 0 评论 -
ASCII码表全部
ASCII码表2008-06-11 09:48美国标准信息交换标准码( American Standard Code for Information Interchange, ASCII )在计算机中,所有的数据在存储和运算时都要使用二进制数表示(因为计算机比较傻,只有0和1两位数的二进制比较适合于它使用),同样的,象a、b、c、d 这样的52个字母(包括大写)、以及0、1、2等数字还有一原创 2015-06-09 15:00:24 · 763 阅读 · 0 评论 -
C++ bool值
#include using namespace std;int n;bool light[65536];bool test[10]={false};int main(){ test[0] = ~test[0]; test[1] = ~test[1]; for(int i=0;i<10; i++) /****输出为 1 1 0 0 0 0 0 0原创 2015-06-09 22:02:21 · 2556 阅读 · 0 评论 -
C++:cin、cin.getline()、getline()的用法
主要内容:1、cin用法2、cin.getline()用法3、getline()用法3、注意的问题 一、cin>>用法1:输入一个数字或字符#include using namespace std;main (){int a,b;cin>>a>>b;cout<<a+b<<endl;}用法2:接收一个字符串,遇转载 2015-06-06 21:42:20 · 337 阅读 · 0 评论 -
关键字static和const的作用
这个简单的问题很少有人能回答完全。在C语言中,关键字static有三个明显的作用:1)在函数体内,一个被声明为静态的变量在这一函数被调用过程中维持其值不变(该变量存放在静态变量区)。2) 在模块内(但在函数体外),一个被声明为静态的变量可以被模块内所用函数访问,但不能被模块外其它函数访问。它是一个本地的全局变量。3) 在模块内,一个被声明为静态的函数只可被这一模块内的其它函数调用。那就转载 2015-09-25 10:00:26 · 462 阅读 · 0 评论