![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++语法基础
wssjn1994
这个作者很懒,什么都没留下…
展开
-
c++反向迭代器reverse_iterator不能直接作为erase的参数
c++反向迭代器reverse_iterator不能直接作为erase的参数原创 2020-09-30 11:16:18 · 656 阅读 · 0 评论 -
C++中string类的基本用法
#include <iostream>#include <string>#include <string.h>using namespace std;int main(){ //获取字符串长度 string str = "hello"; int lens1 = str.length(); int lens2 = str.size(); ...原创 2018-11-06 11:30:21 · 131 阅读 · 0 评论 -
C++重载函数和重载运算符
在同一个作用域内,可以声明几个功能类似的同名函数,但是这些同名函数的形式参数(指参数的个数、类型或者顺序)必须不同。不能仅通过返回类型的不同来重载函数。下面的实例中,同名函数 print() 被用于输出不同的数据类型:#include <iostream>using namespace std;class Printf{ public : void print(...原创 2018-10-23 16:28:09 · 242 阅读 · 0 评论 -
C++内联函数的作用
#include <iostream>#include <sys/time.h>using namespace std;inline void func(){ int a = 0; a++;}int main(){ struct timeval start_t, end_t; double n_time = 0.0; gettimeofday(...原创 2018-11-05 16:07:21 · 2187 阅读 · 0 评论 -
C++基础
C和C++的区别C C++ 结构化 抽象化 重点是数据结构和算法 重点挖掘核心特征 面向过程 面向对象 总结就是解决问题的核心思想和方法不一样。在C++中,int也是一个类,实现了如加减乘除等方法。 在析构函数前加virtual关键字。 构造函数和析构函数定义成public,若使用类名加变量名()的方法创建对象,则它的生命周期为这个大括号。即...原创 2019-03-26 17:25:32 · 83 阅读 · 0 评论 -
jinkens静态检查的错误修改方法和分析总结
The scope of the variable '*********' can be reduced. 变量的作用域可以缩小。报错的原因是可能有个局部变量可以进一步缩小作用域,可以放到更深的括号里Variable '*********' is assigned a value that is never used. 变量被声明了但是从未被使用。报错的原因是可能有定义过但后来又删掉了...原创 2019-06-06 11:36:39 · 4113 阅读 · 0 评论 -
C++基础学习
基于一份示例代码的基础上来总结#include <iostream>#include <string>class Date{public: Date(unsigned int nYear , unsigned int nMonth , unsigned int nDay ); virtual ~Date(); void SetYear(unsigned...原创 2019-05-29 18:21:00 · 139 阅读 · 0 评论