Why won't it work?
#include <iostream>
#include <vector>
#include <iterator>
using namespace std;
int main() {
int in;
cin >> in;
vector<int> list;
int number;
while (cin >> number) {
list.push_back(number);
}
vector<int> range = {1, 2, 3, 4, 5};
for (auto item : range) {
bool truth = false;
for (auto thing : list) {
if (item == thing)
truth = true;
}
if (truth == false)
cout << item << endl;
}
return 0;
}
I tried inputting "5" then under a new line "1 2 3 4" and there is no output. I expected an output of "5".
Here is the problem: https://cses.fi/problemset/task/1083