Hi,
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:
int x;
int y;
string name;
etc.......
Which is the better option here? I prefer the second as taught in ACPP.Code:
cout << "Please enter your name: "
string name;
cin >> name;
Thanks.