D
dtschoepe
Greetings.
I am working on an assignment and can't seem to get the right concept
for something I'm attempting to do with enum data types.
I have defined the following in my code:
enum color {red, blue, green, yellow, black, purple, pink};
What I am doing now is reading from a text file a string (char *). I
wish to compare the value read into the array and determine which
color it is from the enum data type. How can I compare a string like
"red" to see if it exists in the values that are part of the
enumerated data type 'color'? I know I need to write some kind of
compare function, but I'm not getting anywhere figuring out how that
should work.
David
I am working on an assignment and can't seem to get the right concept
for something I'm attempting to do with enum data types.
I have defined the following in my code:
enum color {red, blue, green, yellow, black, purple, pink};
What I am doing now is reading from a text file a string (char *). I
wish to compare the value read into the array and determine which
color it is from the enum data type. How can I compare a string like
"red" to see if it exists in the values that are part of the
enumerated data type 'color'? I know I need to write some kind of
compare function, but I'm not getting anywhere figuring out how that
should work.
David