You can't create two mixed datatypes in an array so you couldn't have the first be a string and second dimension be an int so yes you would want to use a class or struct. I would probably use struct since it defaults to public. Be sure to have the string header included when you do this with #include <string>. I would do something probably like the following below though:
struct characteristics {
string word;
int counter;
};
Then you can create datatypes of that struct so it'd look like characteristics my_variable; for example. Let me know if this helped.
I'm a little out of practice personally with advanced concepts in object-oriented programming, especially when you have classes or structs nested within each other but I do know that a good resource that explains the details of that is Bruce Eckel's first volume of Thinking in C++ Second Edition which is free. Just Google it and you should find it for downloading or viewing online.
Hay Bazzy, that makes perfect sense.. thanks!
and thanks Mike for the reference, I'll check it out.
I think that would work, but I think - I can just do it inside the class without the struct..
1 2 3 4 5 6 7 8 9 10 11 12 13
class Word
{
public:
void setup(string);
int getCount();
string getWord();
void setWord(string);
void setCount(int);
private:
string word;
int wordCount;
} word[500];