Accessing 1 Array Element From A File

In my program I have set up two parallel arrays from a given file. The file looks something like this and has 15 lines:

1233 C
3222 R

and so forth.
In my program the user has to pick a number , 1-15, and that line of the array must be outputted. I am able to print out the entire array, but can not get it to just retrieve the user specified line. Any pointers?
My code is as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// arrays
typedef int sizeOfId[15];
typedef char sizeOfType[15];
sizeOfId songId;
sizeOfType typeOfSong;
// variable that stores the users choice
int songChoice;
cout << endl << "Please enter the number of the song that you would like to play:";
cin >> songChoice

//bad data checking because the choice has to be between 1 and 15
while (songChoice >15 || songChoice < 1)
{
   cout << "You have not entered a valid song choice- please try again:";
   cin >> songChoice
}

int songNum =0;
while (songChoice <= 15 && inFile >> songId[songChoice] >> typeOfSong[songChoice])
{
  songChoice--;
  cout << songId[songChoice] << typeOfSong[songChoice] << endl;
}
Topic archived. No new replies allowed.