Translate

The #include and using statement in C++


Lines of the first program in C + + begins with # include statements that constitute the program.
# include is a directive of the C + + preprocessor, which is a general instruction to the C + + compiler. A # include directive forms <filename> are declarations and definitions that support part of the C + + standard library. Without this directive, you can not use the execution of program listings. If you have been using a version of C + + and C, you do not need to include. <iostream> H as an example but you should include using namespace std; before main.


If you are new to C + +, just remember you have to use # include to drum up support for certain parts of the library of C + + standard. And if we start to use math functions like sqrt (square root), then we have to turn the demand for math libraries such as: # include <cmath> (can <cmath.h> if we do not include using namespace std; before main).

Is this a bit confusing? A little, yes. Include files are due to differences between the C language and runtime library standards. (programmer C / C + + professionals are sometimes avoid the standard library and use their own libraries. We will consider making its own library in the next tutorial).

No comments:

Post a Comment