+ 4

Why do we use "using namespace "and finally "return 0"

29th Aug 2018, 3:35 PM
Shashidhar Pai B
2 Respostas
+ 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.
29th Aug 2018, 4:46 PM
Anna
Anna - avatar
+ 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.
30th Aug 2018, 2:49 AM
Leo
Leo  - avatar