![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
澜临lv
这个作者很懒,什么都没留下…
展开
-
python调用C++实现在文件中搜索单词
test1.cpp#include <Python.h>#include <iostream>#include <vector>#include <set>#include <memory>#include <map>#include <string>#include <fstream>...原创 2020-01-02 14:36:46 · 235 阅读 · 0 评论 -
test
#include <iostream>#include <vector>#include <set>#include <memory>#include <map>#include <string>#include <fstream>#include <sstream>using lin...原创 2019-12-30 20:36:51 · 96 阅读 · 0 评论 -
__cplusplus与extern的作用
1、__cplusplus的作用2、extern的作用1、__cplusplus的作用C+编译器会在编译C++源程序的时候自动生成一个宏:__cplusplus,可以通过这个宏来判断是C源文件还是C++源文件。 代码如下:#include&amp;amp;amp;amp;amp;amp;amp;lt;stdio.h&amp;amp;amp;amp;amp;amp转载 2018-09-01 22:10:13 · 192 阅读 · 0 评论 -
linux下运行C文件或C++文件或生成静态、动态链接库
运行C文件需要编译的源程序为:hello.c生成的可执行文件为:hello$ gcc -o hello hello.c$ ./hello运行C++文件需要编译的源程序为:hello.cpp生成的可执行文件为:hello$ g++ hello.cpp -o hello$ ./hello...原创 2018-11-16 14:15:57 · 498 阅读 · 0 评论 -
虚函数、纯虚函数在继承时的问题
#include &lt;iostream&gt;using namespace std;class A{public: A(){}; ~A(){}; virtual void f(){cout&lt;&lt;"A f()"&lt;&lt;endl;} virtual void g()=0; vo原创 2019-01-21 11:07:08 · 1678 阅读 · 0 评论 -
子类内部调用父类成员函数,及子类对象在外部调用父类成员函数问题(C++)
先看段程序:#include <iostream>using namespace std;class A{private: void f() { cout << "private A::f()" << endl; }protected: void g() { cout &l...原创 2019-02-22 10:15:40 · 4476 阅读 · 0 评论 -
子类调用父类中的成员函数(c++)
在c++中,子类如果要调用父类的成员函数,可以使用::限定符,详情见如下代码:#include &amp;lt;iostream&amp;gt;using namespace std;class A{public: void f() { cout &amp;lt;&amp;lt; &quot;class A f()&quot; &a原创 2019-02-18 11:27:57 · 18130 阅读 · 0 评论 -
MyString
main.cpp#include <iostream>#include <cstring>#ifndef CXX_MYSTRING_H# include "MyString.h"#endifusing namespace std;int main(){ MyString s1; cout << s1 << e...原创 2019-03-22 10:35:57 · 263 阅读 · 0 评论 -
snprintf中的错误,不要出现目标地址也是源地址的情况
在使用snprintf时,千万要注意一点,不要出现目标地址也是源地址的情况。看如下例子:# include <stdio.h># include <string.h>void f(){ printf("snprintf(a, size, b, c)\n"); char a[100] = "1234"; char b[100] = "5678...原创 2019-07-23 23:43:29 · 754 阅读 · 0 评论