What is necessary to include?

Jun 6, 2020 at 5:52pm
I want to make simple programs with C++ (mainly input/output based programs) what do I need to include? Is iostream enough, or do I have to include something else?
Jun 6, 2020 at 6:10pm
It depends what you want to do. You probably need strings, maybe some output formatting (iomanip) . If you want to store your input somewhere you might need vector as well.
If you want to store your output in a file then you need fstreams.
Jun 6, 2020 at 6:42pm
Is there anything you would recommend for a beginner program?
Jun 6, 2020 at 6:45pm
a typical first program or so just has <iostream> and <string>.
after a short while you will realize which ones you need for what things or at least where to look online if you need something and forgot what header it was in.
Jun 6, 2020 at 6:55pm
For a truly basic beginner's program, the famous "Hello World" example, the only header needed is <iostream>.

What you need to include depends on what features of the C++ Library you use. As someone learns more C++ features more headers will be required.

A list of C++ Standard Library headers:
https://en.cppreference.com/w/cpp/header

Some header files include other header files. What is also-included can vary from implementation to implementation. MSVC vs. GCC, for example.
Jun 7, 2020 at 5:08am
Jun 8, 2020 at 5:02pm
Thanks a lot for the help!
Topic archived. No new replies allowed.