I'm teaching myself C++ through googling (my class has no textbook, if you can believe it) so I apologize in advance for my (probably) incorrect terminology.
I want to name individual incarnations of a struct by numeric information supplied by the user. Here is a snippet:
int main (void)
{
int num;
struct Serialnumber
{
string Revision, Date, Department;
};
cout << "Please enter the number of the part you wish to find.\n";
cin >> num;
}
So, if the user inputs 1234 for num, can I make a structure where the name equals the value of num, i.e. Serialnumber 1234?
In the above format, the complier tells me that num is already declared (as the int in the beginning). I'm using Dev C++ 4.9.9.2 if that matters.
I would be most appreciative if anyone could point me towards the appropriate direction, such as a command type. I'm finding it difficult to look up an idea when I don't already know the right name for it.
Thanks for your help. This community's archives have been a godsend for me through the past several months.