https://rentry.org/PPP2_p100c

// Code derived from Stroustrup's PPP2 book
// § 4.4 Statements
// -beginning on p 100

#include <iostream>

using std::cout;

int main() {
  int a = 1;
  int b = 2;

  a = b;
  ++b;

  // a = b ++ b;  // syntax error: missing semicolon

  cout << a << '\n'   // output above variable values to console...
       << b << '\n';  //
}

build & run:

g++ -std=c++20 -O2 -Wall -pedantic ./ch_04/main_p100c.cpp && ./a.out

PrevUpNext

Edit
Pub: 24 Jan 2023 06:54 UTC
Views: 58