cs31 lecture 17

Namespaces well start with a simpler version well 25

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: en is called console/terminal output x Default keyboard is called console/terminal input x This technically needs the concepts of classes, objects, This namespaces, standard includes, etc. namespaces, We’ll start with a simpler version We’ll 25 Console output in C++ #include <iostream> int main()
 { std::cout << “Hello World!” << std::endl; std::cout return 0; return } 26 Including files #include <iostream> xThis instruction specifies that a file, called “ iostream”, is to is be automatically included at the beginning of the source code code xThis file contains the declaration of various classes to This manipulate the console input/output manipulate xMultiple header files exist iostream: for input/outut cmath: for basic math functions (e.g., sqrt)
 27 Common pitfalls with includes x Forgetting to include a header file x Including files in the wrong order, for dependent headers Note: if it is well programmed, this problem should never arise x Including a header that includes itself, without protection example: #...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online