Quote:
Originally Posted by HelloWorld is printf new in C++ as it is new in Java? Is there println in C++ as it is in Java  I've read about cout << "Hello" << something like that, but I'm not sure if you can do that as if you do in println() command
that's because I think using println() is much easier than having to remember all % for printf statement, well it's probably better if you can remember all of them, but I think I'd just print what rpgfan said out and put it in front of your computer  or... yeah, go to C++ reference site |
printf is not new in C++ because C++ evolved from C. You can think of C++ as an extension of C sort of. In C, you include <stdio.h> to use printf. In C++, you include <cstdio>, which refers to the fact that stdio is a C header. Others in C++ include <cstdlib>, <ctime>, etc. (remove the leading 'c' and add ".h" at the end to convert the header notation to C)
As for Java's System.out.println (or System.Console.WriteLine in C#), there is no such thing in C++. The closest thing to it is the std::endl member:
std::cout << "Hello world!" << std::endl; // C++
// System.out.println("Hello world!"); // Java
// System.Console.WriteLine("Hello world!"); // C#
Of course, if you included "using namespace std;" at the beginning of the C++ program, then you don't need to type "std::" to show that the member belongs to the std namespace.