I'm having trouble with a fragment of code in my program. I have to read in data from a file to an array. The basic setup in the data file looks like this...
1234 C
489977 D
359 R
My job is to read in the number into on array and the letter to another parallel one. Heres my code.
switch (catagory)
{
case 'C': songTypes [count] = COUNTRY;
break;
case 'R': songTypes [count] = ROCK;
break;
case 'D': songTypes [count] = DANCEPARTY;
break;
case 'E': songTypes [count] = ELEVATOR;
break;
}
Where count is int, category is char catagory[NUM_SONGS], NUM_SONGS = 15, and int songTypes[NUM_SONGS]
My problem is that I keep getting a compile error that char [15] is illegal in the switch expression. I know that it's trying to read the null character in the array. What I don't know is how to get around that. Thanks for any help!