本文介绍了需要C和C ++中的Hashmap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



~

我发现自己需要一些类似于Hashmap的代码

~

这可以用Java方式轻松完成:

~

import java.util。*;


// __

公共类JMith00Test {

public static void main(String [] aArgs){

HashMap< String,IntegerHMSI = new HashMap< String,Integer> ;();

HMSI.put(" one",(new Integer(1)));

HMSI.put(" zwei",(new Integer) (2)));

HMSI.put(" tres",(new Integer(3)));

// __

String aK;

int iIxCnt = 0;

System.out.println(" // __ HMSI.size():|" + HMSI.size( )+" |");

Iterator< StringIT = HMSI.keySet()。iterator();

while(IT.hasNext()){

aK = IT.next();

System.out.println(" // __ |" + iIxCnt +" |" + aK +" | " +

HMSI.get(aK)+" |");

++ iIx Cnt;

}

}

}

~

我想知道是否有简单的ANSI C哈希图吗?


Thansk

lbrtchx

解决方案



他们倾向于在普通的C中将它们称为哈希表。

是的,它们有很多。



如果它在C中,则不是正确的组。你可以谷歌或发布在

clc。如果您正在寻找c ++,那么您可以在TR1中查看新功能




谢谢,

Balaji。




这个有一个友好的hashmap名称:


Hi,
~
I have found myself in need of some code resembling a Hashmap
~
This is easily done in Java this way:
~
import java.util.*;

// __
public class JMith00Test{
public static void main(String[] aArgs){
HashMap<String, IntegerHMSI = new HashMap<String, Integer>();
HMSI.put("one", (new Integer(1)));
HMSI.put("zwei", (new Integer(2)));
HMSI.put("tres", (new Integer(3)));
// __
String aK;
int iIxCnt = 0;
System.out.println("// __ HMSI.size(): |" + HMSI.size() + "|");
Iterator<StringIT = HMSI.keySet().iterator();
while(IT.hasNext()){
aK = IT.next();
System.out.println("// __ |" + iIxCnt + "|" + aK + "|" +
HMSI.get(aK) + "|");
++iIxCnt;
}
}
}
~
I was wondering if there are plain ANSI C hashmaps?

Thansk
lbrtchx

解决方案

They tend to call them hash tables in ordinary C.
Yes, there are lots of them.


If it is in C, then is not the right group. you may google or post at
clc. If you are looking for c++, then you may look at the new features
in TR1.

Thanks,
Balaji.


This one has a friendly hashmap name:
http://www2.informatik.hu-berlin.de/...src_index.html


这篇关于需要C和C ++中的Hashmap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 15:20