Q:

How to take value from cin into vector.push_back() in one line?

Can I do this in one line?
int temp;
cin >> temp;
vtr.push_back(temp);

For bonus points is there a way to also incorporate a for-loop alternative
 for(int i=0; i < 5; i++){
    int temp;
    cin >> temp;
    vtr.push_back(temp);
}

The caveat is I can't do something like while(cin >> myInt) since the read-in file has multiple lines but I only wanna read 5 at a time. I also have no idea how I could do a oneliner with cin like vtr.push_back(cin >> ??? )

A:

You can use a std::istream_iterator<>.  Here is an example which constructs a std::vector from the contents of stdin:
#include <iostream>
#include <vector>

int main(int argc, char **argv) {
    std::vector<int> vec{
        std::istream_iterator<int>(std::cin),
        std::istream_iterator<int>()};
    for (int i : vec) {
        std::cout << i << '\n';
    }
    return 0;
}

If you would rather, you can use push_back in a loop.
#include <iostream>
#include <vector>

int main(int argc, char **argv) {
    std::vector<int> vec;
    for (std::istream_iterator<int> p{std::cin}, e; p != e; ++p) {
        vec.push_back(*p);
    }
    for (int i : vec) {
        std::cout << i << '\n';
    }
    return 0;
}

