Syntax
#include <iostream>
#include <string>Examples
C++ include directives example
A focused example you can adapt while practising.
#include <iostream>
#include <string>Best practices
- Start with the smallest working example, then adapt it to your project.
- Use the language’s standard library and idioms before introducing extra dependencies.
At a glance
- Purpose
- Systems and general-purpose software
- File extension
- .cpp · .hpp
- Runs in
- Compiled native applications
- Usually used with
- Compiler and standard library
Specifications & further reading
Related C++ documentation
C++ Variables, Types & References
C++ is statically typed: a variable has a type such as int, double, bool, or std::string. A reference declared with & is an alias for an existing object.C++ comments
C++ reference for c++ comments.C++ auto type deduction
C++ reference for c++ auto type deduction.C++ const values
C++ reference for c++ const values.
C++ is statically typed: a variable has a type such as int, double, bool, or std::string. A reference declared with & is an alias for an existing object.C++ comments
C++ reference for c++ comments.C++ auto type deduction
C++ reference for c++ auto type deduction.C++ const values
C++ reference for c++ const values.