You're right, it should work. I don't know why it doesn't work here but when I copy/paste your code and compile it with g++ myself, then it works.
Anyway, I was able to get your code to work by merging lines 7 and 8:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string movieTitle = "Pizza Time";
cout << "Hello World" << endl;
cout << "My favorite movie is " << movieTitle << endl;
return 0;
}
That seems to work for me.