As a general rule, if you're going to ever do a serious project, I'd advise to never use the 'using' keyword. Use std::cout, std::string, etc. instead. It's better form, and in the end it makes code more readable, especially when you're working with functions from many different namespaces.
I know on the basic things that beginners do, "using namespace std" works fine, but I feel it sets people up for bad habits later on. It effectively removes the entire benefit that namespaces provide. So my advice is, rather than starting with "using" and later unlearning it, start off where you'll end up.
This is how I'd code that:
It's not truly necessary to return 0; after main(), because a return 0; is implicit if there's no other return statement.Code:#include <iostream> int main() { char x; std::cout << "Type c and press enter" << std::endl; std::cin >> x; }
Adding std::endl will add a line break after the text.
Any text/website recommending iostream.h is extremely outdated C++, iostream is the new header, and has been for many years now. That would be a good sign to move on to a better tutorial.