https://rentry.org/PPP2_p257

// Code derived from Stroustrup's PPP2 book
// § 8.2 Declarations and definitions
//  -and beginning on p 257

struct Token {};

int a = 7;  // an int variable

const double cd = 8.7;  // a double-precision floating-point constant

double my_sqrt(double);  // a function taking a double argument
                         //  and returning a double result

vector<Token> v;  // a vector-of-Tokens variable

int main()
{
  // Before a name can be used in a C++ program, it must be declared
  cout << f(i) << '\n';
}

build & run:

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

UpNext

Edit
Pub: 04 Apr 2023 13:58 UTC
Edit: 02 May 2023 22:10 UTC
Views: 542