+ 4
Why do we use "using namespace "and finally "return 0"
2 odpowiedzi
+ 9
Several standard functions like cout and cin are defined in the standard namespace (std). To address them, you actually need to write std::cout and std::cin each time. You can avoid that by telling the compiler that you want to use the standard namespace std. Once you do that, you can just use cout, cin etc. without std::
int main() needs to return an integer. 0 is the standard return value. It means that the program finished normally. Every other value indicates an error.
+ 1
using the namespace helps you gain some basic skills like cout and cin. And the main function must return a status code which is type int that indicates whether the program is successfully executed or not. Use 0 for this code if it is successful, and use other values if it is not.