![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
文章平均质量分 90
CHNMSCS
分享是一种快乐,
脚踏实地,仰望星空
展开
-
C++ 中的friend 函数的解释
在C++中,有时会见到用到friend这个关键字来生成friend class 或者 friend function, 小编翻了中文材料,这个friend 翻译成友元,随之就是友元函数或者友元类。现在,小编就为大家来解释一下和如何怎么用这个friend。由于,小编看的是英文教材,所以,会用英文来描述什么是friend和应该如何使用。Remember that with data hiding and原创 2017-11-28 09:33:38 · 3202 阅读 · 1 评论 -
Maximum Depth of Binary Tree --- 二叉树的最大高度
在Leetcode上看到一道题,觉得挺有意思。这道题让我朋友在校招面试Oracle (甲骨文) 时,出了这道题。题目:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the...原创 2019-11-20 14:55:53 · 225 阅读 · 0 评论 -
Reverse String -- 字符串调换位置
在Leetcode上看到一道题:Write a function that reverses a string. The input string is given as an array of characters char[].Do not allocate extra space for another array, you must do this by modifying the i...原创 2019-11-17 05:36:37 · 367 阅读 · 0 评论 -
Rotate Array -- 旋转数组
在Leetcode上看到一道题,觉得很有意思。题目:Given an array, rotate the array to the right by k steps, where k is non-negative.给一个数组和需要旋转的步数,然后显示最后旋转后的数组。Example:Input: [1, 2, 3, 4, 5, 6, 7] and k=3Output: [5,6,7,1...原创 2019-11-09 01:30:44 · 267 阅读 · 0 评论 -
进入C++
欢迎来到C++世界!! 大家都知道,要建造一栋高楼大厦,就得需要很强的地基,做框架。如果一开始没有牢固的结构,那么后面就很难建造其他设施了。所以这个就等同于学习计算机语言时,应从程序的基本结构开始学起。只有这样,才能一步一步了解其具体细节,这样才能激起兴趣继续学下去。 那下面,就先让大家看看一段C++代码。 //first.cpp -- displays a message原创 2017-04-24 14:00:23 · 403 阅读 · 0 评论 -
进入C++ --- main() 函数
欢迎来到c++世界!! 在写本博客内容之前,先将上次所用到的代码展示出来,然后再继续今天内容。 代码如下://first.cpp -- displays a message//language: C++#include<iostream> //a preprocessor directiveusing namespace std; //make definitions visi原创 2017-04-24 16:24:46 · 813 阅读 · 0 评论 -
关于C++ 的constant Member function 的讲解
在C++中,我们时常看到有时候在写函数时需要标明是const函数还是非const函数,尤其是在运算符重载中,用到const这个关键字很多次,所以,小编在此就讲解一下。由于小编是看英文版的教材的,所以在这里就总结一下。小编也是用英文来总结,但是会跟代码一起来解释。Constant Member Functions 1. Any member function that does NOT modi原创 2017-11-21 12:42:57 · 2780 阅读 · 0 评论