Hi, I'm trying to migrate to C++ from C (which I had a basic knowledge of). I'm just wondering, what should I use:
as an example, or:
using namespace std;
cout << "Hello\n";
cin >> x;
or something like that?
std::cout << "hello\n";
std::cin >> x;
Well, you should definitely use the std::string type to hold sequences of characters, there's no doubt about it.
Rather the second. The first example is vulnerable to buffer overflows if user types more than 49 characters. The second is not. (Use smart containers over raw arrays, smart pointer over raw pointers).
You should probably not use using namespace in new code, but it's not that bad as long as you don't do that in a header.