da****************@gmail.com wrote:
I have:
struct person
{
enum gender {male, female};
You declared a type, you declared its possible values. But you didn't
declare any data member that would carry the value. Did you mean to do
gender sex;
here?
};
How do I input information like this:
person John;
...
cin >> John.gender?
...
The best "work-around" would be to enter a char and then if it is 'm'
or 'M', set 'John.sex' to 'person::male', and if the char is 'f' or
'F', set 'John.sex' to 'person::female', and otherwise report bad input.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask