I am tryn a currency converter using hash table. What is the technique to use to enble covert both ways. Ex: Dollers to Euro and Euro to Dollers .

I can understand how to do it one way using currency as the hashKey and rate as Hashvalue. (I hope that is the correct way?).

How to do this. Please help. Thankx in advance.

why would you want to use a HashTable for that? seems like overkill to me.

But it is a requirement. Is there a way to do this. Please help.

Is this to convert bewteen any two currencies (eg GBP <> EUR, EUR <> USD, USF <> GBP etc), or just between different currencies and one "base" currency (eg EUR <> USD, GBP <> USD, YEN <> USD etc)? I ask because you talk of a currency as the key, not a pair of currencies.

It is just between different currencies and one "base" currency. As you metioned it is like
EUR <> USD, GBP <> USD, YEN <> USD .
Can that be implemented in hash table?

The reverse rate is just 1/rate, so you just need key(currency name) -> value (rate), and you can calculate the reverse rate on the fly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.