Chapter 2: Introduction To C++ PDF

Summary

This document introduces C++ programming concepts, including elements like comments, preprocessor directives, and output statements. This is a chapter from a computer science textbook, focusing on introductory C++ concepts.

Full Transcript

Chapter 2: Introduction to C++ Copyright © 2012 Pearson Education, Inc. C++ Program Parts Copyright © 2012 Pearson Education, Inc. The Parts of a C++ Program // sample C++ program comment #include preprocessor directive...

Chapter 2: Introduction to C++ Copyright © 2012 Pearson Education, Inc. C++ Program Parts Copyright © 2012 Pearson Education, Inc. The Parts of a C++ Program // sample C++ program comment #include preprocessor directive using namespace std; which namespace to use int main() beginning of function named main { beginning of block for main cout Open/close brackets Enclose filename in #include ( ) Open/close Used when naming a parentheses function { } Open/close brace Encloses a group of statements " " Open/close Encloses string of quotation marks characters ; Semicolon End of a programming statement Copyright © 2012 Pearson Education, Inc. The cout Object Displays output on the computer screen You use the stream insertion operator

Use Quizgecko on...
Browser
Browser