C++
文章平均质量分 53
C++学习笔记
一碗小米饭
这个作者很懒,什么都没留下…
展开
-
KMP算法书写格式
有关于KMP算法的题,在笔试时应该快速写出。所以本文将详细介绍KMP算法的书写格式,保证一遍快速写对。构造next数组 void getnext(string needle, int* next){ //首先初始化next[0],并定义j=0 next[0] = 0; int j = next[0]; //进入for循环 for (int i = 1; i < needle.size(); i++){ while原创 2022-04-05 00:43:06 · 371 阅读 · 0 评论 -
C++ 双冒号以及命名空间
1、双冒号1.1 作为作用域解析运算符#include <iostream>class my_class{public: static void say(){ std::cout << "hello my_class" << std::endl; }};namespace my_space{ void say(){ std::cout << "hello my_space" <<原创 2022-03-20 15:17:45 · 1584 阅读 · 1 评论 -
C/C++中与输入有关的函数们
C1、getc() #include <stdio.h> int getc( FILE *stream );读取stream中的下一个字符2、fgetc() #include <stdio.h> int fgetc( FILE *stream );读取stream中的下一个字符,fgetc()和getc()是相同的。3、getchar() #include <stdio.h> int getchar( void );返回标准输入输原创 2022-02-24 17:14:33 · 212 阅读 · 0 评论 -
模板类的声明和定义要放在同一文件内
VS2013报错错误 2 error LNK1120: 1 个无法解析的外部命令错误 1 error LNK2019: 无法解析的外部符号 “public: class Vector & __thiscall Vector::operator=(class Vector const &)” (??4?$Vector@H@@QAEAAV0@ABV0@@Z),该符号在函数 _main 中被引用 E:\DIY\diy\diy\main.obj diy最近在自己造轮子,动手写了一个Vector原创 2021-04-02 09:56:24 · 143 阅读 · 0 评论