When should we include the headers. | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

When should we include the headers.

#include<string> and #include<sstream> or when is the header-string and sstream required.

19th Jul 2017, 2:23 AM
stephen haokip
stephen haokip - avatar
2 Réponses
+ 5
Keto Z answer is spot on. You include the headers when you need some functionalilty from them. we include iostream for cin cout endl and stuff. without it we couldnt use these and would have to write the code for this functionality ourselves. edit: for those specific headers you would need them for working with strings and stringstreams.
19th Jul 2017, 3:01 AM
jay
jay - avatar
+ 3
In a program, you pull from the libraries you include in your programs. So, you could include string.h to use string data types. It's also useful to create your own headers to include in your programs.
19th Jul 2017, 2:34 AM
Keto Z
Keto Z - avatar