I was given this payroll code without arrays and tasked with converting it to arrays. When it runs, I am able to input the amount of employees and a first name, but when I try to input a second name I get
Exception thrown at 0x7A5E3B59 (vcruntime140d.dll) in OOP Project.exe: 0xC0000005: Access violation writing location 0xCCCCCCCC.
If there is a handler for this exception, the program may be safely continued.
I don't understand why this happening, please help!
Remove all the [X] from the members of employee. Within the class you don't have arrays. The array is this employee CS[X];.
Further more: You cannot use X as an index because the index within the array starts with 0 and hence ends at X - 1. So because X is out of bounds you get the crash.
I suggest that you use a more descriptive name instead of X like max_employees or so.