I am trying to create input that allows an individual name to have seven courses attached to it before the next name is input. I have tried with the following code but it is still not working as I thought it would. I want the name to go in and then seven course names and then the next name. Right now it asks for a name and then after the input it throws out all the enter the courses.

#include <iostream.h>
#include <stdlib.h>
#include <string.h>

int main()
{
char lname[2][50];
char course [2][7][50];
int x;
int y;

for (x=0; x<2;x++)
{ cout<<"Enter name";
cin.getline (lname[x],50,'\n');
cin.ignore();
for (y=0; y<7; y++)
cout<<"Enter a course";
cin.getline (course[x][y],50,'\n');
cin.ignore();
}

for (x=0; x<2; x++)
cout<<lname[x];
for (y=0; y<7; y++)
cout<<course[x][y];

system("PAUSE");
return 0;
}