Let\'s consider the following hello world examples in C and C++:
main.c
#include
int main()
{
printf(\"Hello world\\n\");
r
So, in this case, what am I paying for?
std::cout is more powerful and complicated than printf. It supports things like locales, stateful formatting flags, and more.
If you don't need those, use std::printf or std::puts - they're available in .
It is famous that in C++ you pay for what you eat.
I also want to make it clear that C++ != The C++ Standard Library. The Standard Library is supposed to be general-purpose and "fast enough", but it will often be slower than a specialized implementation of what you need.
On the other hand, the C++ language strives to make it possible to write code without paying unnecessary extra hidden costs (e.g. opt-in virtual, no garbage collection).