harini
harini

Reputation: 3

How to map the country names in one enum to the time zone in another seperate enum

I am having an enum named Country like this,

Enum_1: typedef enum = {Pacific/Midway, America/Adak, Etc/GMT+10, Pacific/Marquesas, Pacific/Gambier}Country;

and an enum for storing their corresponding time zones

Enum_2: typedef enum = {GMT-11:00, GMT-10:00, GMT-10:00, GMT-09:30, GMT-09:00}zone;

I want to give the country as input from the user. When the input is given the code has to check the Country in Enum_1 and if the country is present, then it maps to the corresponding time zone in Enum_2

I know that enum returns only integer. I don't know whether we can map one enum to other

Example input: Pacific/Midway

Output should be: GMT-11:00

I am really confused about this. I want to know even if it is possible to implement this method in C?

Upvotes: 0

Views: 304

Answers (0)

Related Questions