0

```
/*Write a program which will print all the pairs of prime numbers whose
sum equals the number entered by the user. */
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int maxNum;
bool prime = true;
cin >> maxNum;
vector <int> primeSequence;
for(int i = 1; i <= maxNum; i++)
{
for(int j = 2; j < i; j++)
{
if( i % j == 0 || i == 1)
{
prime = false;
}
}
if(prime == true)
{
primeSequence.push_back(i);
cout << primeSequence[i] << " is a prime\n";
}
prime = true;
}
}
```

The code worked fine until I tried to implement vectors. I just printed `i`

instead of primeSequence.

If I try to run it now, it just returns "random" numbers (some are even negative).

I never really worked with vectors, because arrays seemed sufficient so any help would be appreciated :)