Chapter 2 - Simple C++ Programs
Chapter 2 - Simple C++ Programs
Hoboken,
NJ. All Rights Reserved.
Chapter 2
Simple C++ Programs
Outline
Objectives
1. C++ Program Structure
2. Constant and Variables
3. C++ Classes
4. Building C++ Solutions with IDEs:Xcode
5. C++ Operators
6. Standard Input and Output
7. Building C++ Solutions with IDEs:NetBeans
8. Basic Functions in C++ Standard Library
9. Problem Solving Applied
10.System Limitations
©2017 Pearson Education, Inc. Hoboken, NJ. All
Rights Reserved.
Objectives
Develop problem-solving solutions in
C++ containing:
• Simple arithmetic computations
• Information printed on the screen
• User-supplied Information from keyboard
• Programmer-defined data types
Structure
cout << "The distance between the two points is "
<< distance << endl;
// Exit program.
return 0;
}
//--------------------------------------------------------
Declarations:
•Define identifiers and
allocate memory.
•May also provide initial
values for variables.
•Identifiers must be
declared before using
in a statement.
•C++11 recommends
using { } notation.
• Assignment Operator
• Arithmetic Operators
General Form:
cout << expression << expression;