Trying to debug, stuck!!

Pages: 12
> But that's the value for c. Can it be the same value for both?

No.
To clarify :
1
2
3
4
cout << "Enter a name: ";
getline(cin, Animals[i].c);

Animals[i].d = MyEnum(rand() % 4); 

.

+ Animals[i].c is a std::string, so we use std::getline()
+ Animals[i].d is an enum, so we assign an enum value to it (MyEnum)
Last edited on
Does that? :)
Lol, no. I still get numbers only. I have to figure out the code to change numbers to words. I did it before with a different code, but that one didn't involve enums. It was two strings, an array and a float.
> Lol, no. I still get numbers only. I have to figure out the code to change numbers to words.

Then you use this :
cout << "aStruct data: a = " << aStruct.a << " b = " << aStruct.b << " c = " << aStruct.c << " d (string) = " << MyEnumName[aStruct.d] << endl;

For your information : (MyEnumName) has not ever been used once.

Which means it's time to use it :)
Does that help you? : )
OMG this is so frustrating. Ok so that code gives me the names that the code asks for but instead of getting a random animal it mixes up the order that i input the names.

Oh and good catch BTW, I'm so lost in this F'ing code I totally overlooked that.
So your problem is solved now?
What are the questions of your current assignment?
No, it is still not giving me the proper output. I hate to keep bothering you though. I'll text a TA in the morning to get more help. Thanks for helping me this far though :)
Good to hear :)
Topic archived. No new replies allowed.
Pages: 12