I just realized that I am supposed to include the #include<cstdlib>
required by abs()
for the abs()
function.
#include<iostream>
using namespace std;
int main()
{
int result;
result = abs(-10);
cout << result << "\n";
return 0;
}
Why does this code still work, even though I forgot the important header (#include<cstdlib>
)?