cin >> name[50];

Get rid of the brackets. eg:

cin >> name;
infile >> name;