#include <iostream>
using namespace std;
int main() {
// your code goes here
cout << max(1, 5);
return 0;
}
(Sorry for my bad English) Hi! I can't understand how it works. I'm not using algorithm header but it work. I test it on Visual Studio 2019, xcode and ideone.com. Please check the screenshot. Thank you.
iostream(or any other header) can include further other headers, but there is no guarantee about which headersiostreammight include or if this will change in future or for all std libs. So you should always include the header corresponding to the functions and classes you are about to use in the file directly.<iostream>header there implicitly or explicitly includes the<algorithm>header somewhere. A rule of thumb is: if you need a header, include it, do not rely on the implementation.