![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
文章平均质量分 59
sinat_24310873
湾区实习中。
展开
-
eclipse CDT 开发的一些小问题解决方案,不断更新中...
一. CDT编辑代码时提示member declaration not found 或者 type cannot be solved, 本人试过网上的各种方法都不行, 包括更改indexer什么的都不行,其实这个问题和编译器没有个关系,只和IDE本身有关, 最方便快捷的方法是重新卸载cdt然后安装一个更稳定版本的,方法如下:help->Install New Software, 右下角有一个原创 2016-11-29 04:08:01 · 2071 阅读 · 0 评论 -
[C++]Leetcode #8 atoi()
class Solution {public: int myAtoi(string str) { int n=str.length(); int number[n]; int j=-1, flag=0; for(int i=0;i<n;i++) { if(str[i]=='+' || st原创 2016-12-20 05:32:08 · 402 阅读 · 0 评论 -
C++ count和count_if的使用
1)count(first,last,value):first是容器的首迭代器,last是容器的末迭代器,value是询问的元素,整个函数返回int型。count函数的功能是:统计容器中等于value元素的个数。2)count_if(first,last,comp) (在comp为true的情况下计数) 或者 count_if(first,last,value,comp) (这个是在comp为原创 2016-11-27 13:56:17 · 18546 阅读 · 2 评论 -
C++如何表示数无限大
C++如何表示无限大?1 正无穷大即比任何其他的数都大,所以在c语言中特定数据类型的正无穷大则可以用该数据类型的最大值来表示2 借助limits.h库,里面定义了各种数据类型的最大值3 部分数据类型及其对应的最大值如下int->INT_MAXunsigned int ->UINT_MAXlong->LONG_MAXunsigned long->ULONG_MAX原创 2016-11-13 02:51:38 · 29882 阅读 · 1 评论 -
[C++]next_permutation()函数解析
C++/STL中定义的next_permutation和prev_permutation函数则是非常灵活且高效的一种全排列方法,需要有头文件, 它被广泛的应用于为指定序列生成不同的排列。按照STL文档的描述,next_permutation函数将按字母表顺序生成给定序列的下一个较大的序列,直到整个序列为减序为止。prev_permutation函数与之相反,是生成给定序列的上一个较小的序列。二者原原创 2016-11-27 06:27:57 · 2354 阅读 · 0 评论 -
[c++]Leetcode #7 reverse number
7. Reverse Integer Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321Have you thought about this?Here are some good questions原创 2016-11-26 17:31:22 · 300 阅读 · 0 评论 -
[C++] LeetCode #6 ZigZag Conversion
class Solution {public: string convert(string s, int numRows) { string ans; int length=s.size(); int step=2*numRows-2; if(numRows==1) { ans=s;原创 2016-11-24 17:51:01 · 290 阅读 · 0 评论 -
[C++]LeetCode #1 twoSum
class Solution {public: vector twoSum(vector& nums, int target) {//返回类型为vector的int型的函数 vector sum;//先声明一个vector变量 for(int i=0;i<nums.size();i++){ for(int j=i+1;j<nums.原创 2016-11-24 06:27:47 · 349 阅读 · 0 评论 -
C/C++中typedef struct和struct的区别
在C中,定义一个结构体可以并建议用typedef struct,如下代码:typedef struct Employee//Employee是标识符,可以不写Employee{ int empNumber; int age; int departNumber;}Emp;此处Emp是一个结构体类型,使用的时候需要于是在声明结构体变量的时候:Emp emp1; 此原创 2016-11-23 15:08:50 · 750 阅读 · 0 评论 -
C++vector的使用方法
在c++中,vector是一个十分有用的容器,下面对这个容器做一下总结。一、 基本操作(1)头文件#include, 另外需要使用 using namespace std;(2)创建vector对象,vector vec;(3)尾部插入数字:vec.push_back(a);(4)使用下标访问元素,cout(5)使用迭代器访问元素.vector::iterator原创 2016-11-24 06:35:52 · 322 阅读 · 0 评论