Hexo

  • Home

  • Archives

CPP Primer: Chapter 1 Getting Started

Posted on 2019-08-26

Cpp Primer Notes

This a implementation of some of the exercises from the book: C++ Primer. And also some notes from the book. The github source could be found here.

Prerequisites

Ubuntu 18.04 LTS
gcc/g++: 5.5
vscode: 1.35.0, x64

Chapter 1 Getting Started

1.4 Flow of control

1.4.1 The While statement

1
2
int b = ++a;  // a + 1 before assigned to b, cal after a + 1;
int c = a++; // a + 1 after assigned to c, cal before a + 1;

1.4.3 Reading an Unknown Number of INputs

  • The end of input is CTRL + d;
  • It is a good practice to recompile the code after each fix – or after making at most a small number of obvious fixes. This is called edit-compile-debug.
  • exercise at input_if.cc

1.5 Introducing Classes

  1. Memeber function: a function that is defined as part of a class, sometimes referred to as methods;
  2. (): the call operator;
  • Uninitialized variables are a rich source of bugs;
CPP Primer: Chapter 3 String, Vectors, and Arrays
CPP Primer Chapter 4: Expressions
  • Table of Contents
  • Overview

Zepyhrus

12 posts
  1. 1. Cpp Primer Notes
    1. 1.1. Prerequisites
    2. 1.2. Chapter 1 Getting Started
    3. 1.3. 1.4 Flow of control
      1. 1.3.1. 1.4.1 The While statement
      2. 1.3.2. 1.4.3 Reading an Unknown Number of INputs
    4. 1.4. 1.5 Introducing Classes
© 2020 Zepyhrus
Powered by Hexo v3.9.0
|
Theme – NexT.Mist v7.3.0