I am new to C++. I've read in section #include <string>
They said that we must #include <string> before using string data type, but it is still run when i do not put #include <string> line.
I think your compiler is just being nice to you. <iostream> is not required (actually, it is not supposed to) #include <string>. If you using strings, you should #include <string>, whether or not your particular compiler lets you get away without it.
I never noticed that.. I used the older version of dev c++ and it wouldn't allow that.
The compiler notices that you are using a 'string' variable type and automatically adds in the correct header file without you knowing. Its best practice to declare the headers and not to rely on the compiler to do it.