Cin works without string library

I’m using Xcode and when I typed the program using cin before you said we needed to add the library, it still worked out fine. I’m wondering why that is or maybe I’m making a mistake?

XCode uses Clang by default and has a different implementation to MSVC (what visual studio uses by default) of the C++ Standard Library. So string is most likely already #included in iostream. You should still #include the things you use to be compiler independent though.

Privacy & Terms