chevengur

Подготовительный курс | Урок 10: Строки 3/3

Aug 14th, 2023 (edited)
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <algorithm>
  5.  
  6. int main() {
  7.     std::vector<std::string> books;
  8.     for (int i = 0; i < 3; ++i) {
  9.         std::string name_book;
  10.         std::getline(std::cin, name_book);
  11.         books.push_back(name_book);
  12.     }
  13.     std::reverse(books.begin(), books.end());
  14.     for (const auto& num_book : books) {
  15.         std::cout << num_book << std::endl;
  16.     }
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment