Kagalive

collections-v-00004

Sep 30th, 2020
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.05 KB | None | 0 0
  1. //https://app.pluralsight.com/course-player?clipId=9591b217-52b1-41d4-97d8-498731301073
  2. //https://bit.ly/freePS2020
  3.  
  4. //RECOMMENDED: VS2019 COMMUNITY [FREE IDE] @ https://bit.ly/3mYgad3
  5.  
  6. //includes.h
  7.  
  8.  
  9. #include <iostream>
  10. using std::cout;
  11. using std::cin;
  12.  
  13. #include <string>
  14. using std::string;
  15.  
  16. #include <vector>
  17. using std::vector;
  18. using std::begin;
  19. using std::count;
  20.  
  21. #include <algorithm>
  22. using std::sort;
  23. using std::count;
  24.  
  25.  
  26.  
  27. //collections.cpp
  28.  
  29. #include "includes.h"
  30.  
  31. int main()
  32. {
  33.  
  34.     vector<int> nums;
  35.        
  36.     for (int i = 0; i < 10; i++)
  37.     {
  38.         nums.push_back(i);
  39.     }
  40.  
  41.     for (auto item : nums)
  42.     {
  43.         cout << item << " ";
  44.     }
  45.     cout << "\n";
  46.  
  47.     vector<string> words;
  48.  
  49.     cout << "Enter Three Words: "
  50.     for (int i = 0; i < 3; i++)
  51.     {
  52.     string s;
  53.     cin >> s;
  54.     words.push_back(s);
  55.     }
  56.  
  57.  
  58.     for (auto item: words)
  59.     {
  60.     cout << item << " ";
  61.     }
  62.     cout << "\n";
  63.  
  64.     cout << "int vector nums has " << nums.size() << " elements." << '\n\;
  65.  
  66.  
  67.  
  68.  
  69. }
Add Comment
Please, Sign In to add comment