Hello, there!

COMPUTER SCIENCE & PROGRAMMING (CS 04103 – Section 3,4)

Chapter 2: Introduction to C++

Prof. Uppalapati, Vinay Kumar

Computer Science Department Rowan University

2.1 The Parts of a C++ Program

  • Overview of the basic structure of a C++ program.

  • Example:

  #include <iostream>
  using namespace std;
  int main() {
    cout << "Hello, there!";
    return 0;
  }
  • Key Points of the Example:

    • #include <iostream>: Preprocessor directive that includes standard input-output stream library.

    • using namespace std;: Indicates that the standard namespace is used.

    • int main() { ... }: Starting point of a C++ program; defines the main function.

    • `cout <<