https://rentry.org/PPP2_p296c

// Code derived from Stroustrup's PPP2 book
// § 8.7.1 using declarations and using directives
//  -and beginning on p 296

#include <iostream>  // get the iostream library
#include <string>    // get the string library

using namespace std;  // make names from std directly accessible

int main()
{
  string name;
  cout << "Please enter your first name\n";
  cin >> name;
  cout << "Hello, " << name << '\n';
}

build & run:

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

PrevUpNext

Edit
Pub: 04 Apr 2023 15:27 UTC
Edit: 03 May 2023 00:54 UTC
Views: 529