CIS 3142 — Chapter 1

CISC 3142
Programming Paradigms in C++
Chapter 1 — The Basics

Reading from the Text

1.1 Introduction

1.2 Programs

1.2.1 Hello World

Sample C++ Program #1

#include <iostream>

int main() 
	std::cout << "Hello world" << std::endl;
}

#include <iostream>

using namespace std;

int main() 
	cout << "Hello world" << endl;
}

1.3 Functions

1.4 Types, Variables, and Arithmetic

Declarations

A declaration is a statement that introduces a name into the program. It specifies a type for the named entity:
  • bool as integer type
  • char - usually 8 bit
  • const / constexpr
    • constexpr must be a compile-time value

    1.4.1 Arithmetic

    Usual suspects: arithmetici (simple and compound), comparison, logical, iand bitwise.

    1.4.2 Initialization

    auto

    1.5 Scope and Lifetime

    1.6 Constants

    1.7 Pointers, Arrays, and References

    Pointers

    Here is a more comprehensive write-up on pointers, arrays, references, and several related topics
    void *
    nullptr

    Arrays

    References