In University we have been taught to declare variables at the top, eg:
However, working through Accelerated C++, they use a different approach, for example:Code:
Which is the better option here? I prefer the second as taught in ACPP.Code:
cout << "Please enter your name: "
cin >> name;