<iostream> includes the following functions:
1 2 3 4 5 6 7 8
|
std::cin
std::cout
std::cerr
std::clog
std::wcin
std::wcout
std::wcerr
std::wclog
|
|
Almost, but all of these aren't functions, they are objects of type ostream or istream, not functions.
when or why should i use iostream library!? |
Basically every time you want inputs and outputs.
The iostream library has a very nice and typesafe interface.
It also has some fancy stuff to align your text to the right or left or to ignore whitespaces in strings.
You can set if you want your numers printed as binary, decimal or hexadecimal number.
You can set it to print bools as "true" or "false" instead of 1 or 0.
In addition to that you can make your objects streamable pretty easily (just overload operator<<) which is very nice.
If you want to change the output device you just have to set rdbuf to whatever buffer it should write.
This may have gone pretty deep but these are a few advantages iostream has over cstdio.
You may be able to achieve one or the other of them with cstdio as well but it wont be that pretty.