I have to write a program for school that has user input ten movie titles and their corresponding ratings. This program must use parrallel arrays. There is more to the program but not needed for the issue I am currently having. I cannot seem to get the string for the movie title to get into the array correctly. When running this piece of the program, I input the first movie title, then the rating, then it continues printing, but skipping the input for the movie title and going directly to the rating for ten instances of the question. I have played with different ways to get this to work correctly, but no luck. Here is the code snippet for this part of the program.
// Program to prompt user to enter ten movie rental choices
// and rate them 1-5. Convert ratings to number of *'s and
// sort using parallel arrays.
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main()
{
cout << "This is a program that will let you enter ten movie rental " << endl;
cout << "titles and rate them." << endl;
cout << "Ratings are entered 1 through 5, with 5 being the highest rating. " << endl;
cout << endl;
cout << endl;
char movieTitle[10][50];
int rating[10];
int j = 0;
int i = 0;
for (j; j < 10; j++)
{
cout << "Enter ten movie rental movie titles and thier corresponding ratings." << endl;
cin.get(movieTitle[j], 50);
cout << "Enter a rating for " << movieTitle[j] << "." << endl;
cin >> rating[i];
i++;
}
return 0;
}