Must iostream always be included? | Sololearn: Learn to code for FREE!

0

Must iostream always be included?

Must #include <iostream> be in the header of every C++code? Could you get by using other libraries instead?

c++

8/30/2019 4:28:34 AM

Clavis Janes

1 Answer

New Answer

+6

What headers you need to include depends on what your program does. Does your program require input and output streams? If so, you need <iostream>. If you're asking about a different way to do console I/O, you can check <cstdio> (or <stdio.h>), which contains functions like printf() and scanf(). #include <cstdio> int main() { printf("Hello, World."); } If your program does not require any input and output functionalities, a program without including any headers, as such: int main() { } is completely valid.