![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++
wwzhang0307
这个作者很懒,什么都没留下…
展开
-
c++面试题分析
//腾讯QQ2008年笔试题中的附加题(30分) //从程序健壮性进行分析,下面的FillUserInfo函数和main函数分别 //存在什么问题? #include <iostream> #include <string> #include <memory> #define MAX_NAME_LEN 20 struct转载 2016-09-23 17:23:55 · 220 阅读 · 0 评论 -
条件编译 #ifndef _HEAD_H...中下划线的理解!
条件编译 #ifndef _HEAD_H...中下划线的理解!一、下划线“__”属于编程风格的内容,对程序没有影响。不用下划线也可以,用几个下划线也由个人习惯。二、其实质是一个宏名。由此我们可以防止发生重复定义或声明。假设你的头文件名为head.h,根据习惯,我们声明一个宏HEAD_H,对应这个头文件,在头文件中开始的地方和结尾的地方加上 对HEAD_H的声明和判断,头文件Head.h如下: #转载 2016-12-09 10:01:46 · 3430 阅读 · 1 评论 -
c++ STL "map"
#include <iostream>using namespace std;#include "map";#include "string";//map的添加/遍历/删除void main1(){ map<int, string> map1; //插入方法1 map1.insert(pair<int, string>(1, "teacher1")); m原创 2016-11-26 11:23:44 · 229 阅读 · 0 评论 -
c++ STL “multiset”
#include <iostream>using namespace std;#include "set"void main1001(){ multiset<int> set1; int tmp = 0; while (tmp!=-1) { cout << "请输入multiset的值:" << endl; scanf("%d"原创 2016-11-24 21:27:23 · 200 阅读 · 0 评论 -
c++ STL "set"
#define _CRT_SECURE_NO_WARNINGS#include <iostream>using namespace std;#include "set"#include "functional"//1 集合 元素唯一,不能安装[] 和at()方式插入值。自动排序void main91(){ set<int> set1; //set的插入 for (原创 2016-11-23 21:00:15 · 189 阅读 · 0 评论 -
c++_类的运算符重载
#include <iostream>using namespace std;class Test{public: int a; int b;public: Test(int a=0, int b=0) { cout << "有参构造函数" << endl; this->a = a; this->b = b;原创 2016-09-26 22:42:41 · 272 阅读 · 0 评论 -
STL 排序算法 复制 交换 求和 填充
void ShowEmlmt(int& obj){ cout << obj << " ";}void main2(){ vector<int> v1; v1.push_back(1); v1.push_back(3); v1.push_back(5); vector<int> v2; v2.push_back(2); v2.push原创 2016-12-02 14:00:40 · 210 阅读 · 0 评论 -
c++ 优先级队列 priority_queue
#include <iostream>using namespace std;#include "queue"#include <vector> #include <functional> //最小值优先级队列库void main81(){ priority_queue<int> p1; priority_queue<int, vector<int>, less<int原创 2016-11-21 20:37:38 · 376 阅读 · 0 评论 -
c++ list链表
#include <iostream>using namespace std;#include "list"void main71(){ list<int> a1; cout << "list的大小:" << a1.size() << endl; for (int i = 0; i < 10; i++) { a1.push_back(i + 1)原创 2016-11-21 20:36:27 · 360 阅读 · 0 评论 -
c++ vector
#include <iostream>using namespace std;#include "vector"void main31(){ vector<int> v1; cout << "length:" << v1.size() << endl; v1.push_back(1);//push_back(obj)尾部压入obj的意思 v1.push_back原创 2016-11-20 21:18:11 · 300 阅读 · 0 评论 -
STL遍历算法 “for_each ”,“transform”
void ShowEmlmt(int& obj){ cout << obj << " ";}void main1(){ vector<int> v1; v1.push_back(1); v1.push_back(2); v1.push_back(3); for_each(v1.begin(), v1.end(), ShowEmlmt); r原创 2016-12-01 15:33:18 · 344 阅读 · 0 评论 -
c++ “算法学习”
#include <iostream>using namespace std;#include <algorithm>#include <functional>#include <set>#include <vector>#include <string>//遍历vector对象void printV(vector<int> v1){ for (int i = 0; i <原创 2016-11-30 21:23:21 · 392 阅读 · 0 评论 -
c++ string类型使用
#include <iostream> using namespace std;#include "string"//字符串类初始化void main21(){ string a1="aaa"; string a2("bbb"); string a3(3,'c'); cout<<a1<<a2<<a3<<endl;}//string的遍历void main原创 2016-11-17 14:33:30 · 262 阅读 · 0 评论 -
c++模板类 各种函数在类外实现
#include <iostream>using namespace std;/*模板类 各种函数在类外的实现*/template <typename T>class AA{public: AA(T a, T b); void printAA(); AA operator+(AA &tmp); //友元函数重载<< friend ostream& o原创 2016-11-02 15:56:16 · 7774 阅读 · 0 评论 -
c++类的操作符重载
以下是自己学习c++类的操作符重载自己写的string类#include <iostream>#include <string.h>using namespace std;//字符串类编写class mystring{public: mystring(int size,const char* mstring) { m_len=size; m原创 2016-11-16 15:51:42 · 313 阅读 · 0 评论 -
c++ STL "multimap"
#include <iostream>using namespace std;#include "map"#include "string"class Person{public: string name; int age; string tel; double saly;};//multimap的创建void main1(){ Person原创 2016-11-27 21:54:19 · 211 阅读 · 0 评论