需要C和C ++中的Hashmap [英] Need Hashmap in C AND C++
问题描述
~
我发现自己需要一些类似于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
4月24日,7:18 * pm,lbrt ... @ gmail.com写道:
*
~
*我发现自己需要一些类似于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)));
// __
*字符串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;
*}
*}}
~
*我想知道是否有平原ANSI C哈希映射?
他们倾向于在普通的C中将它们称为哈希表。
是的,它们有很多。
4月25日,7:18 * am,lbrt ... @ gmail.com写道:
*
~
*我发现自己需要一些类似于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)));
// __
*字符串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;
*}
*}}
~
*我想知道是否有简单的ANSI C哈希图?
* Thansk
* lbrtchx
如果它在C中,则不是正确的组。你可以谷歌或发布在
clc。如果您正在寻找c ++,那么您可以在TR1中查看新功能
。
谢谢,
Balaji。
4月24日,7:18 * pm,lbrt ... @ gmail.com写道:
*
~
*我发现自己需要一些类似于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)));
// __
*字符串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;
*}
*}}
~
*我想知道是否有简单的ANSI C哈希映射?
这个有一个友好的hashmap名称:
http://www2.informatik.hu-berlin.de/...src_index.html
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
On Apr 24, 7:18*pm, lbrt...@gmail.com wrote:*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?They tend to call them hash tables in ordinary C.
Yes, there are lots of them.
On Apr 25, 7:18*am, lbrt...@gmail.com wrote:*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
*lbrtchxIf 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.
On Apr 24, 7:18*pm, lbrt...@gmail.com wrote:*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?This one has a friendly hashmap name:
http://www2.informatik.hu-berlin.de/...src_index.html
这篇关于需要C和C ++中的Hashmap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!