I just made this program and i'm not understanding why all of my errors are only for when the structure variables are trying to be used, so if anyone could help me figure out what's wrong here then i'd really appreciate it.
request for member `name' in `emp', which is of non-class type `employee[((unsigned int)((int)i))]'
All of the errors say that except change which part of the structure it's talking about.
i still can't get the coding for the array right, i'm reading and rereading it but i do not understand this.
what is the coding supposed to be in order to get this to work? i've obviously never done this before
Your notation is wrong where you try to access members of your emp array.
Incorrect: emp.xyz[k]
Correct: emp[k].xyz
It looks like there are 30-40 places in your code where this correction needs to be made.
I think that kbw was referring to your illegal use of an array with a dimension determined at run time:
1 2 3
cout << "How many employees are in the company?" << endl;
cin >> i;
employee emp[i];// no no no! i must be a pre-determined constant.
However, some compilers apparently allow this. Maybe it will work on your system.
If you wish to do it correctly look into either the STL vector object or dynamic memory allocation.
well, i got it working (thanks), but for some reason i'm not getting what i should be getting as the input of my file. It's saved in the right place, emp.name should come out as a word but it's coming out as some random sequence of numbers, any idea what could be causing this?