https://rentry.org/PPP2_p263

// Code derived from Stroustrup's PPP2 book
// § 8.2.3 Default initialization
//  -and beginning on p 263

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
  vector<string> v;
  string         s;

  while (cin >> s)
    v.push_back(s);
}

build & run:

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

PrevUpNext

Edit
Pub: 04 Apr 2023 14:18 UTC
Edit: 02 May 2023 22:14 UTC
Views: 387