variable vector sequence

I’ve started to learn C++ a couple of weeks ago and it’s been going quite smooth. Right now I’m trying to figure out how to make a vector (got that down), make the size a variable put in by the user (got that down too). Now where I run into problems is, I need to make the vector sequencial (1, 2, 3, 4 etc) as big as the users size input. For example, if user input is 5 it will be 1, 2, 3, 4, 5.
This is what I have until now (the bit I’m stuck with at least):
1
2
3
4
std::cin >> iterations
std::vector <int> sequence;
        sequence.push_back(iterations);
    for (int i = 0; i < sequence.size(); ++i)

I hope this question is understandable for you, and I hope someone can push me in the right direction :)
1
2
3
4
  std::cin >> iterations
  std::vector <int> sequence;
  for (int i = 0; i < iterations; ++i)
    sequence.push_back(i+1);

1
2
3
4
  std::cin >> iterations
  std::vector <int> sequence(iterations);
  for (int K = 0; K < iterations; ++K)
    sequence[K] = K+1;
Topic archived. No new replies allowed.