Do I have to use #include beside ?

Yes, you have to include what you use. It’s not mandated that standard headers include one another (with a few exceptions IIRC). It might work now, but might fail on a different compiler.

In your case, apparently <iostream> includes <string>, directly or indirectly, but don’t rely on it.

Leave a Comment