According to book from which I am learning C++, you should add string library before using string data type, but suddenly when I missed adding string library the program was still working fine why?
( https://i.imgsafe.org/2bb7b68.png )
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
string day = "Monday";
cout << day << " Go to school\n";
return 0;
}
and also working without string library:-
1 2 3 4 5 6 7 8 9 10 11 12
#include <iostream>
usingnamespace std;
int main()
{
string day = "Monday";
cout << day << " Go to school\n";
return 0;
}
So, why we write a additional line if program is working fine without it, or it is doing something else that I am missing to know?