map, hash_map,unordered_map_LJDaisy的博客-程序员秘密

   

map, hash_map,unordered_map

 

Map是STL的一个关联容器,它提供一对一(其中第一个可以称为关键字,每个关键字只能在map中出现一次,第二个可能称为该关键字的值)的数据 处理能力,由于这个特性,它完成有可能在我们处理一对一数据的时候,在编程上提供快速通道。这里说下map内部数据的组织,map内部自建一颗红黑树(一 种非严格意义上的平衡二叉树),这颗树具有对数据自动排序的功能,所以在map内部所有的数据都是有序的,后边我们会见识到有序的好处。

下面举例说明什么是一对一的数据映射。比如一个班级中,每个学生的学号跟他的姓名就存在着一一映射的关系,这个模型用map可能轻易描述,很明显学 号用int描述,姓名用字符串描述(本篇文章中不用char *来描述字符串,而是采用STL中string来描述),下面给出map描述代码:

Map mapStudent;

1.       map的构造函数

map共提供了6个构造函数,这块涉及到内存分配器这些东西,略过不表,在下面我们将接触到一些map的构造方法,这里要说下的就是,我们通常用如下方法构造一个map:

Map mapStudent;

2.       数据的插入

在构造map容器后,我们就可以往里面插入数据了。这里讲三种插入数据的方法:

第一种:用insert函数插入pair数据,下面举例说明(以下代码虽然是随手写的,应该可以在VC和GCC下编译通过,大家可以运行下看什么效果,在VC下请加入这条语句,屏蔽4786警告  #pragma warning (disable:4786) )

#include

#include

#include

Using namespace std;

Int main()

{

       Map mapStudent;

       mapStudent.insert(pair(1, “student_one”));

       mapStudent.insert(pair(2, “student_two”));

       mapStudent.insert(pair(3, “student_three”));

       map::iterator  iter;

       for(iter = mapStudent.begin(); iter != mapStudent.end(); iter++)

{

       Cout<<iter->first<<”   ”<<iter->second<<end;

}

}

第二种:用insert函数插入value_type数据,下面举例说明

#include

#include

#include

Using namespace std;

Int main()

{

       Map mapStudent;

       mapStudent.insert(map::value_type (1, “student_one”));

       mapStudent.insert(map::value_type (2, “student_two”));

       mapStudent.insert(map::value_type (3, “student_three”));

       map::iterator  iter;

       for(iter = mapStudent.begin(); iter != mapStudent.end(); iter++)

{

       Cout<<iter->first<<”   ”<<iter->second<<end;

}

}

第三种:用数组方式插入数据,下面举例说明

#include

#include

#include

Using namespace std;

Int main()

{

       Map mapStudent;

       mapStudent[1] =  “student_one”;

       mapStudent[2] =  “student_two”;

       mapStudent[3] =  “student_three”;

       map::iterator  iter;

       for(iter = mapStudent.begin(); iter != mapStudent.end(); iter++)

{

       Cout<<iter->first<<”   ”<<iter->second<<end;

}

}

以上三种用法,虽然都可以实现数据的插入,但是它们是有区别的,当然了第一种和第二种在效果上是完成一样的,用insert函数插入数据,在数据的 插入上涉及到集合的唯一性这个概念,即当map中有这个关键字时,insert操作是插入数据不了的,但是用数组方式就不同了,它可以覆盖以前该关键字对 应的值,用程序说明

mapStudent.insert(map::value_type (1, “student_one”));

mapStudent.insert(map::value_type (1, “student_two”));

上面这两条语句执行后,map中1这个关键字对应的值是“student_one”,第二条语句并没有生效,那么这就涉及到我们怎么知道insert语句是否插入成功的问题了,可以用pair来获得是否插入成功,程序如下

Pair::iterator, bool> Insert_Pair;

Insert_Pair = mapStudent.insert(map::value_type (1, “student_one”));

我们通过pair的第二个变量来知道是否插入成功,它的第一个变量返回的是一个map的迭代器,如果插入成功的话Insert_Pair.second应该是true的,否则为false。

下面给出完成代码,演示插入成功与否问题

#include

#include

#include

Using namespace std;

Int main()

{

       Map mapStudent;

Pair::iterator, bool> Insert_Pair;

       Insert_Pair = mapStudent.insert(pair(1, “student_one”));

       If(Insert_Pair.second == true)

       {

              Cout<<”Insert Successfully”<<endl;

       }

       Else

       {

              Cout<<”Insert Failure”<<endl;

       }

       Insert_Pair = mapStudent.insert(pair(1, “student_two”));

       If(Insert_Pair.second == true)

       {

              Cout<<”Insert Successfully”<<endl;

       }

       Else

       {

              Cout<<”Insert Failure”<<endl;

       }

       map::iterator  iter;

       for(iter = mapStudent.begin(); iter != mapStudent.end(); iter++)

{

       Cout<<iter->first<<”   ”<<iter->second<<end;

}

}

大家可以用如下程序,看下用数组插入在数据覆盖上的效果

#include

#include

#include

Using namespace std;

Int main()

{

       Map mapStudent;

       mapStudent[1] =  “student_one”;

       mapStudent[1] =  “student_two”;

       mapStudent[2] =  “student_three”;

       map::iterator  iter;

       for(iter = mapStudent.begin(); iter != mapStudent.end(); iter++)

{

       Cout<<iter->first<<”   ”<<iter->second<<end;

}

}

3.       map的大小

在往map里面插入了数据,我们怎么知道当前已经插入了多少数据呢,可以用size函数,用法如下:

Int nSize = mapStudent.size();

4.       数据的遍历

这里也提供三种方法,对map进行遍历

第一种:应用前向迭代器,上面举例程序中到处都是了,略过不表

第二种:应用反相迭代器,下面举例说明,要体会效果,请自个动手运行程序

#include

#include

#include

Using namespace std;

Int main()

{

       Map mapStudent;

       mapStudent.insert(pair(1, “student_one”));

       mapStudent.insert(pair(2, “student_two”));

       mapStudent.insert(pair(3, “student_three”));

       map::reverse_iterator  iter;

       for(iter = mapStudent.rbegin(); iter != mapStudent.rend(); iter++)

{

       Cout<<iter->first<<”   ”<<iter->second<<end;

}

}

第三种:用数组方式,程序说明如下

#include

#include

#include

Using namespace std;

Int main()

{

       Map mapStudent;

       mapStudent.insert(pair(1, “student_one”));

       mapStudent.insert(pair(2, “student_two”));

       mapStudent.insert(pair(3, “student_three”));

       int nSize = mapStudent.size()

//此处有误,应该是 for(int nIndex = 1; nIndex <= nSize; nIndex++)


//by rainfish

       for(int nIndex = 0; nIndex < nSize; nIndex++)

{

       Cout<<mapStudent[nIndex]<<end;

}

}

5.       数据的查找(包括判定这个关键字是否在map中出现)

在这里我们将体会,map在数据插入时保证有序的好处。

要判定一个数据(关键字)是否在map中出现的方法比较多,这里标题虽然是数据的查找,在这里将穿插着大量的map基本用法。

这里给出三种数据查找方法

第一种:用count函数来判定关键字是否出现,其缺点是无法定位数据出现位置,由于map的特性,一对一的映射关系,就决定了count函数的返回值只有两个,要么是0,要么是1,出现的情况,当然是返回1了

第二种:用find函数来定位数据出现位置,它返回的一个迭代器,当数据出现时,它返回数据所在位置的迭代器,如果map中没有要查找的数据,它返回的迭代器等于end函数返回的迭代器,程序说明

#include

#include

#include

Using namespace std;

Int main()

{

       Map mapStudent;

       mapStudent.insert(pair(1, “student_one”));

       mapStudent.insert(pair(2, “student_two”));

       mapStudent.insert(pair(3, “student_three”));

       map::iterator iter;

       iter = mapStudent.find(1);

if(iter != mapStudent.end())

{

       Cout<<”Find, the value is ”<<iter->second<<endl;

}

Else

{

       Cout<<”Do not Find”<<endl;

}

}

第三种:这个方法用来判定数据是否出现,是显得笨了点,但是,我打算在这里讲解

Lower_bound函数用法,这个函数用来返回要查找关键字的下界(是一个迭代器)

Upper_bound函数用法,这个函数用来返回要查找关键字的上界(是一个迭代器)

例如:map中已经插入了1,2,3,4的话,如果lower_bound(2)的话,返回的2,而upper-bound(2)的话,返回的就是3

Equal_range函数返回一个pair,pair里面第一个变量是Lower_bound返回的迭代器,pair里面第二个迭代器是Upper_bound返回的迭代器,如果这两个迭代器相等的话,则说明map中不出现这个关键字,程序说明

#include

#include

#include

Using namespace std;

Int main()

{

       Map mapStudent;

       mapStudent[1] =  “student_one”;

       mapStudent[3] =  “student_three”;

       mapStudent[5] =  “student_five”;

       map::iterator  iter;

iter = mapStudent.lower_bound(2);

{

       //返回的是下界3的迭代器

       Cout<<iter->second<<endl;

}

iter = mapStudent.lower_bound(3);

{

       //返回的是下界3的迭代器

       Cout<<iter->second<<endl;

}

 

iter = mapStudent.upper_bound(2);

{

       //返回的是上界3的迭代器

       Cout<<iter->second<<endl;

}

iter = mapStudent.upper_bound(3);

{

       //返回的是上界5的迭代器

       Cout<<iter->second<<endl;

}

 

Pair::iterator, map::iterator> mapPair;

mapPair = mapStudent.equal_range(2);

if(mapPair.first == mapPair.second)
       {

       cout<<”Do not Find”<<endl;

}

Else

{

Cout<<”Find”<<endl;
}

mapPair = mapStudent.equal_range(3);

if(mapPair.first == mapPair.second)
       {

       cout<<”Do not Find”<<endl;

}

Else

{

Cout<<”Find”<<endl;
}

}

6.       数据的清空与判空

清空map中的数据可以用clear()函数,判定map中是否有数据可以用empty()函数,它返回true则说明是空map

7.       数据的删除

这里要用到erase函数,它有三个重载了的函数,下面在例子中详细说明它们的用法

#include

#include

#include

Using namespace std;

Int main()

{

       Map mapStudent;

       mapStudent.insert(pair(1, “student_one”));

       mapStudent.insert(pair(2, “student_two”));

       mapStudent.insert(pair(3, “student_three”));

 

//如果你要演示输出效果,请选择以下的一种,你看到的效果会比较好

       //如果要删除1,用迭代器删除

       map::iterator iter;

       iter = mapStudent.find(1);

       mapStudent.erase(iter);

 

       //如果要删除1,用关键字删除

       Int n = mapStudent.erase(1);//如果删除了会返回1,否则返回0

 

       //用迭代器,成片的删除

       //一下代码把整个map清空

       mapStudent.earse(mapStudent.begin(), mapStudent.end());

       //成片删除要注意的是,也是STL的特性,删除区间是一个前闭后开的集合

 

       //自个加上遍历代码,打印输出吧

}

8.       其他一些函数用法

这里有swap,key_comp,value_comp,get_allocator等函数,感觉到这些函数在编程用的不是很多,略过不表,有兴趣的话可以自个研究

9.       排序

这里要讲的是一点比较高深的用法了,排序问题,STL中默认是采用小于号来排序的,以上代码在排序上是不存在任何问题的,因为上面的关键字是int 型,它本身支持小于号运算,在一些特殊情况,比如关键字是一个结构体,涉及到排序就会出现问题,因为它没有小于号操作,insert等函数在编译的时候过 不去,下面给出两个方法解决这个问题

第一种:小于号重载,程序举例

#include

#include

Using namespace std;

Typedef struct tagStudentInfo

{

       Int      nID;

       String   strName;

}StudentInfo, *PStudentInfo;  //学生信息

 

Int main()

{

    int nSize;

       //用学生信息映射分数

       mapmapStudent;

    map::iterator iter;

       StudentInfo studentInfo;

       studentInfo.nID = 1;

       studentInfo.strName = “student_one”;

       mapStudent.insert(pair(studentInfo, 90));

       studentInfo.nID = 2;

       studentInfo.strName = “student_two”;

mapStudent.insert(pair(studentInfo, 80));

 

for (iter=mapStudent.begin(); iter!=mapStudent.end(); iter++)

    cout<<iter->first.nID<<endl<<iter->first.strName<<endl<<iter->second<<endl;

 

}

以上程序是无法编译通过的,只要重载小于号,就OK了,如下:

Typedef struct tagStudentInfo

{

       Int      nID;

       String   strName;

       Bool operator < (tagStudentInfo const& _A) const

       {

              //这个函数指定排序策略,按nID排序,如果nID相等的话,按strName排序

              If(nID < _A.nID)  return true;

              If(nID == _A.nID) return strName.compare(_A.strName) < 0;

              Return false;

       }

}StudentInfo, *PStudentInfo;  //学生信息

第二种:仿函数的应用,这个时候结构体中没有直接的小于号重载,程序说明

#include

#include

Using namespace std;

Typedef struct tagStudentInfo

{

       Int      nID;

       String   strName;

}StudentInfo, *PStudentInfo;  //学生信息

 

Classs sort

{

       Public:

       Bool operator() (StudentInfo const &_A, StudentInfo const &_B) const

       {

              If(_A.nID < _B.nID) return true;

              If(_A.nID == _B.nID) return _A.strName.compare(_B.strName) < 0;

              Return false;

       }

};

 

Int main()

{

       //用学生信息映射分数

       MapmapStudent;

       StudentInfo studentInfo;

       studentInfo.nID = 1;

       studentInfo.strName = “student_one”;

       mapStudent.insert(pair(studentInfo, 90));

       studentInfo.nID = 2;

       studentInfo.strName = “student_two”;

mapStudent.insert(pair(studentInfo, 80));

}

10.   另外

由于STL是一个统一的整体,map的很多用法都和STL中其它的东西结合在一起,比如在排序上,这里默认用的是小于号,即less<>,如果要从大到小排序呢,这里涉及到的东西很多,在此无法一一加以说明。

还要说明的是,map中由于它内部有序,由红黑树保证,因此很多函数执行的时间复杂度都是log2N的,如果用map函数可以实现的功能,而STL  Algorithm也可以完成该功能,建议用map自带函数,效率高一些。

下面说下,map在空间上的特性,否则,估计你用起来会有时候表现的比较郁闷,由于map的每个数据对应红黑树上的一个节点,这个节点在不保存你的 数据时,是占用16个字节的,一个父节点指针,左右孩子指针,还有一个枚举值(标示红黑的,相当于平衡二叉树中的平衡因子),我想大家应该知道,这些地方 很费内存了吧,不说了……



4.1 hash_map和map的区别在哪里?

  • 构造函数。hash_map需要hash函数,等于函数;map只需要比较函数(小于函数).
  • 存储结构。hash_map采用hash表存储,map一般采用红黑树(RB Tree)实现。因此其memory数据结构是不一样的。

4.2 什么时候需要用hash_map,什么时候需要用map?

总 体来说,hash_map 查找速度会比map快,而且查找速度基本和数据量大小无关,属于常数级别;而map的查找速度是log(n)级别。并不一定常数就比log(n) 小,hash还有hash函数的耗时,明白了吧,如果你考虑效率,特别是在元素达到一定数量级时,考虑考虑hash_map。但若你对内存使用特别严格,希望程序尽可能少消耗内存,那么一定要小心,hash_map可能会让你陷入尴尬,特别是当你的hash_map对象特别多时,你就更无法控制了,而且 hash_map的构造速度较慢。

现在知道如何选择了吗?权衡三个因素: 查找速度, 数据量, 内存使用。

这里还有个关于hash_map和map的小故事,看看:http://dev.csdn.net/Develop/article/14/14019.shtm

4.3 如何在hash_map中加入自己定义的类型?

你只要做两件事, 定义hash函数,定义等于比较函数。下面的代码是一个例子:

#include <hash_map>

#include <string>

#include <iostream>

 

using namespace std;

//define the class

class ClassA{

        public:

        ClassA(int a):c_a(a){}

        int getvalue()const { return c_a;}

        void setvalue(int a){c_a=a;}

        private:

        int c_a;

};

 

//1 define the hash function

struct hash_A{

        size_t operator()(const class ClassA & A)const{

                //  return  hash<int>(classA.getvalue());

                return A.getvalue();

        }

};

 

//2 define the equal function

struct equal_A{

        bool operator()(const class ClassA & a1, const class ClassA & a2)const{

                return  a1.getvalue() == a2.getvalue();

        }

};

 

int main()

{

        hash_map<ClassA, string, hash_A, equal_A> hmap;

        ClassA a1(12);

        hmap[a1]="I am 12";

        ClassA a2(198877);

        hmap[a2]="I am 198877";

       

        cout<<hmap[a1]<<endl;

        cout<<hmap[a2]<<endl;

        return 0;

}


 

I am 12

I am 198877



今天看到 boost::unordered_map, 它与 stl::map的区别就是,stl::map是按照operator<比较判断元素是否相同,以及比较元素的大小,然后选择合适的位置插入到树中。所以,如果对map进行遍历(中序遍历)的话,输出的结果是有序的。顺序就是按照operator< 定义的大小排序。

而boost::unordered_map是计算元素的Hash值,根据Hash值判断元素是否相同。所以,对unordered_map进行遍历,结果是无序的。


用法的区别就是,stl::map 的key需要定义operator< 。 而boost::unordered_map需要定义hash_value函数并且重载operator==。对于内置类型,如string,这些都不用操心。对于自定义的类型做key,就需要自己重载operator< 或者hash_value()了。 


最后,说,当不需要结果排好序时,最好用unordered_map。


其实,stl::map对于与java中的TreeMap,而boost::unordered_map对应于java中的HashMap。 


stl::map

[cpp]  view plain copy
  1. #include<string>  
  2. #include<iostream>  
  3. #include<map>  
  4.   
  5. using namespace std;  
  6.   
  7. struct person  
  8. {  
  9.     string name;  
  10.     int age;  
  11.   
  12.     person(string name, int age)  
  13.     {  
  14.         this->name =  name;  
  15.         this->age = age;  
  16.     }  
  17.   
  18.     bool operator < (const person& p) const  
  19.     {  
  20.         return this->age < p.age;  
  21.     }  
  22. };  
  23.   
  24. map<person,int> m;  
  25. int main()  
  26. {  
  27.     person p1("Tom1",20);  
  28.     person p2("Tom2",22);  
  29.     person p3("Tom3",22);  
  30.     person p4("Tom4",23);  
  31.     person p5("Tom5",24);  
  32.     m.insert(make_pair(p3, 100));  
  33.     m.insert(make_pair(p4, 100));  
  34.     m.insert(make_pair(p5, 100));  
  35.     m.insert(make_pair(p1, 100));  
  36.     m.insert(make_pair(p2, 100));  
  37.       
  38.     for(map<person, int>::iterator iter = m.begin(); iter != m.end(); iter++)  
  39.     {  
  40.         cout<<iter->first.name<<"\t"<<iter->first.age<<endl;  
  41.     }  
  42.       
  43.     return 0;  
  44. }  

output:

Tom1    20
Tom3    22
Tom4    23
Tom5    24


operator<的重载一定要定义成const。因为map内部实现时调用operator<的函数好像是const。

由于operator<比较的只是age,所以因为Tom2和Tom3的age相同,所以最终结果里面只有Tom3,没有Tom2


boost::unordered_map

[cpp]  view plain copy
  1. #include<string>  
  2. #include<iostream>  
  3.   
  4. #include<boost/unordered_map.hpp>  
  5.   
  6. using namespace std;  
  7.   
  8. struct person  
  9. {  
  10.     string name;  
  11.     int age;  
  12.   
  13.     person(string name, int age)  
  14.     {  
  15.         this->name =  name;  
  16.         this->age = age;  
  17.     }  
  18.   
  19.     bool operator== (const person& p) const  
  20.     {  
  21.         return name==p.name && age==p.age;  
  22.     }  
  23. };  
  24.   
  25. size_t hash_value(const person& p)  
  26. {  
  27.     size_t seed = 0;  
  28.     boost::hash_combine(seed, boost::hash_value(p.name));  
  29.     boost::hash_combine(seed, boost::hash_value(p.age));  
  30.     return seed;  
  31. }  
  32.   
  33. int main()  
  34. {  
  35.     typedef boost::unordered_map<person,int> umap;  
  36.     umap m;  
  37.     person p1("Tom1",20);  
  38.     person p2("Tom2",22);  
  39.     person p3("Tom3",22);  
  40.     person p4("Tom4",23);  
  41.     person p5("Tom5",24);  
  42.     m.insert(umap::value_type(p3, 100));  
  43.     m.insert(umap::value_type(p4, 100));  
  44.     m.insert(umap::value_type(p5, 100));  
  45.     m.insert(umap::value_type(p1, 100));  
  46.     m.insert(umap::value_type(p2, 100));  
  47.       
  48.     for(umap::iterator iter = m.begin(); iter != m.end(); iter++)  
  49.     {  
  50.         cout<<iter->first.name<<"\t"<<iter->first.age<<endl;  
  51.     }  
  52.       
  53.     return 0;  
  54. }  

输出

Tom1    20
Tom5    24
Tom4    23
Tom2    22
Tom3    22


必须要自定义operator==和hash_value。 重载operator==是因为,如果两个元素的hash_value的值相同,并不能断定这两个元素就相同,必须再调用operator==。 当然,如果hash_value的值不同,就不需要调用operator==了。


版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/sinat_24520925/article/details/46766267

智能推荐

大数据时代,如何防止“数据裸奔”?_软件工程师如何防止大数据泄露隐私_linghujing的博客-程序员秘密

  社交娱乐、资讯阅读、网络购物、旅游攻略、美食烹饪、健身跑步、讲座课程……在智能手机加载不同种类的APP应用后,人们的生活开始变得方便快捷、多姿多彩。然而,大数据、云计算、人工智能等新技术的运用,在充分发挥数据价值的同时,也给个人隐私保护带来严峻挑战,数据产业的发展和个人信息安全之间出现了失衡。隐私or便利互联网上的“透明人”“中国人更加开放,对隐私问题没有那么敏感,很多...

PCL三维点云拼接融合技术_sampleconsensusmodelregistration_天涯泛孤舟的博客-程序员秘密

首先,编译或下载PCL运行库:http://pointclouds.org/downloads/,并配置环境。然后,进行配准操作,本例使用pcd格式点云文件进行配准:1.点云粗配准拼接#include #include #include #include #include #include #include #include using namespace pcl;

Apache DolphinScheduler 使用文档(6/8):任务节点类型与任务参数设置_DolphinScheduler社区的博客-程序员秘密

本文章经授权转载,原文链接:https://blog.csdn.net/MiaoSO/article/details/104770720目录6. 任务节点类型和参数设置6.1 Shell...

Java数组声明、创建、初始化_周辉的博客-程序员秘密

本文讲述了Java数组的几个相关的方面,讲述了对Java数组的声明、创建和初始化,并给出其对应的代码。AD: 51CTO云计算架构师峰会 抢票进行中!一维数组的声明方式:type var[]; 或type[] var;声明数组时不能指定其长度(数组中元素的个数),Java中使用关键字new创建数组对象,格式为:数组名 = new 数组

java 如何使用缓冲区对文件进行读写操作_画家丶的博客-程序员秘密

首先,了解下什么是缓冲区: 电脑内存分成5个区,他们分别是堆、栈、自由存储区、全局/静态存储区和常量存储区。栈——就是那些由编译器在需要的时候分配,在不需要的时候自动清楚的变量的存储区。里面的变量通常是局部变量、函数参数等。堆——就是那些由new分配的内存块,他们的释放编译器不去管,由我们的应用程序去控制,一般一个new就要对应一个delete.如果程序员没有释放掉,那么在程序结束后,操作系统会自

随便推点

Quick Cocos2dx 场景转换问题_weixin_30563319的博客-程序员秘密

项目结构是这样子的:主场景代码是这样子的:local MainScene = class("MainScene", function() return display.newScene("MainScene")end)function MainScene:ctor() self.layer = display.newLayer(); s...

java数组(Array):数组的下标,为什么从0开始(通俗理解)?_数组下标从0开始是什么意思_陆顺治的博客-程序员秘密

本文索引:1.数组的由来:a.字面引申:b.通俗解释:数组的特点:2.数组下标为什么从0开始:a.初步理解:b.加深理解:1.数组的由来:// 变量声明int a = 1;int b = 2;int c = 3;int d = 4;...int n = 20;// 一个int类型4个字节,一个字节占8位a.字面引申:看到上面的这些int数据,都是int类型,有人就想,既然...

一文学会Git、GitHub常用操作_Shingle_的博客-程序员秘密

Git常用指令的笔记,用于git日常操作安装Git首先在电脑上装一个Git吧,地址:https://git-scm.com/downloadGit的初始设置设置姓名和邮箱地址git config --global user.name "your_name" git config --global user.email "[email protected]"提高可读性git config

程序员职业思维导图_OnlyPiglet的博客-程序员秘密

大家好:从本次博客开始为了对应AC项目我要准备程序员的职业思维导图啦 这是个人整理的会慢慢持续更新的呀,深感路漫漫其修远兮我将上下而求索...

OpenGL “太阳、地球和月亮”天体运动动画 例子_weixin_30284355的博客-程序员秘密

http://oulehui.blog.163.com/blog/static/7961469820119186616743/OpenGL “太阳、地球和月亮”天体运动动画 例子2011-10-18 18:06:16|分类:OpenGL|标签:opengl实例例子|举报|字号订阅#include &lt;GL/glut.h&...

月球太阳轨迹matlab,地球月球太阳轨迹 地球和月球运行轨迹图_粗糙阿琼的博客-程序员秘密

华杨 生 殖 健 康 网 wwW.91Hy.CoM 编辑组稿八月十五中秋佳节,有圆月当空才算给力。来自中国科学院紫金山天文台消息,今年的圆月将出现在农历八月十五当晚7时许,而此时正是举家团圆推杯换盏的晚饭之际,如果当晚气象条件允许,人们可以举杯邀明月,在圆月的陪伴下,过一个完美的中秋佳节。据介绍,下一个中秋佳节有圆月相伴,需要轮回8年。此外,在这个9月,英仙座流星雨和“双星伴月”的天象也将让夜空变...

推荐文章

热门文章

相关标签