https://rentry.org/PPP2_p296a

// 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

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

build & run:

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

PrevUpNext

Edit
Pub: 04 Apr 2023 15:22 UTC
Edit: 03 May 2023 00:51 UTC
Views: 355