We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
-Don't use 'printf' here, it's a C function. C++ is not C in any way. Use 'std::cout' instead.
-Never use 'using namespace std'. This directive has been added for compatibility purpose and can lead into multiple definitions in larger projects. It breaks the namespace principle. However, you can use it for literals (e.g. 'using namespace std::chrono_literals'). If you really don't want to use the 'std::' prefix, you can use 'using std::cout', 'using std::endl' and so on for each function, class, etc. you want to import in the global namespace.
Say "Hello, World!" With C++
You are viewing a single comment's thread. Return to all comments →
-Don't use 'printf' here, it's a C function. C++ is not C in any way. Use 'std::cout' instead.
-Never use 'using namespace std'. This directive has been added for compatibility purpose and can lead into multiple definitions in larger projects. It breaks the namespace principle. However, you can use it for literals (e.g. 'using namespace std::chrono_literals'). If you really don't want to use the 'std::' prefix, you can use 'using std::cout', 'using std::endl' and so on for each function, class, etc. you want to import in the global namespace.
And with 'using':