C++
Kobe Forever
自信乐观,善待他人,善待自己!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C++——char* vs std::string vs char[]
char* eg:char* str = "This is GeeksForGeeks"; pros: 一个指针指向字符串,节省内存; 不需要提前指定字符串大小。 cons: 上述例子在C语言中work,但是C++会有warning提示,因此,在C++中,要加const修饰。eg:const char* str = "This is GeeksForGeeks"; C++中字符串都是常...原创 2019-03-09 10:37:59 · 653 阅读 · 0 评论 -
C++ STL modulus(取模): %
取模运算在c++11中用%表示。 根据ISO14882:2011(e) The binary / operator yields the quotient, and the binary % operator yields the remainder from the division of the first expression by the second. If the second...原创 2019-03-06 20:26:36 · 3241 阅读 · 0 评论 -
leetcode[28]Implement strStr()
问题:"火柴堆找针”[1] 输入:“火柴堆”string haystack,“针”string needle 输出:火柴堆中第一根针出现的位置 思路: two pointer,外层循环遍历火柴堆,内层循环遍历针 代码如下: class Solution { public: int strStr(string haystack, string needle) { ...原创 2019-03-10 22:00:50 · 202 阅读 · 0 评论
分享