首页 > 编程知识 正文

cma软件,有没有有顺序的map实现类

时间:2023-05-03 08:42:37 阅读:41046 作者:1398

# include ' STD afx.h ' # includeafxtempl.h # include iostream # includealgorithmusingnamespacestd; 类型定义结构{ int number; bool sex; char name[260]; }Student; CMap int,int,Student,Studentmap; intmain(intargc,char* argv[] ) students t1={ 17,0,' dale'}; sudent ST2={ 13,0,' linying' }; students T3={ 11,0,' hive' }; map.inithashtable(17,false ); map.setat(ST1.number,st1 ); map.setat(ST2.number,st2 ); map.setat(ST3.number,st3 ); cout ' hashtablesize=' map.gethashtablesize () endl; Student st; map.lookup(17,st ); cout '学号17的学生姓名为: ' st.name endl; //插入学号34此学号将插入到与17日相同的链表中。 由于密钥不同,添加到链表中的所有studentst0={ 34,1,'沉默的样子' }; map.lookup(34,st0 ); cout '学号34的学生姓名为: ' st0.name endl; //修正值存在34号,因此以前的值studentst4={ 34,1,' hxdrs' }; map.lookup(34,st4 ); cout '学号34的学生姓名为: ' st4.name endl; getchar (; 返回0; }

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。