Hello, i've been learning how to write in C++ using the tutorials on www.cplusplus.com for currently 3 days, so ofcourse my code will look very ammaturish. As I'm getting to grips with the syntax, i'm working on a simple program that lets you name how many films are your favourite, and specify what those films are called. Obviously its rather pointless, but as I said I'm practicing what i've learnt from the C++ syntax so far. The error in my code is not preventing execution, it's just not doing what I want it to do. // A program that lets you name "n" films.
using namespace std;
int main ()
int n, i;
cout << "How many favourite films do you have?" << endl;
cin >> quant;
stringstream(quant) >> n;
cout << "What are your " << n << " favourite films?" << endl;
for (i = 0; i < n; i ++)
cout << "Movie " << i << " is: " << n_movie[i] << endl;
Once I run the code, I can enter my number but the console straight away also prints "Movie 0 is: " without allowing me to specify what movie movie 0 is. I can enter all movies up to movie n-1 as i should be able to. Thanks in advance.