void time_read(double arr[6][10], int i, string movie[6]);
int main()
{
int i(0);
double arr[6][10];
string movie[6];
int num_movies;
cout << "Please input the number of movies you'd like to watch: ";
cin >> num_movies;
while(i < num_movies)
{
time_read(arr, i, movie);
i++;
}
}
void time_read(double arr[6][10], int i, string movie[6])
{
int j;
for (j = 0; j < i; j++)
{
double time, hours, minutes;
cout << "Enter the name of the movie followed by a #: ";
getline(cin, movie[i], '#');
cout << "Enter the movie time in hours then minutes: ";
cin >> hours >> minutes;
time = hours + minutes/60;
arr[i][j] = time;
}
}
It exits because you're initialising i to 0 in your main function, and then passing it into time_read(). In time_read, your loop condition is (j < i). If i is 0, and you initialise j to 0, then j is never less than i. This means that the body of your for loop won't be executed.
This also means that no matter what number you put in for num_movies, the first time you call time_read(), it will do nothing, because the first time it is called, i is 0.
Why do you need two loops? You have a while loop in main and a for loop in time_read(). What's the purpose of that?