include iostream include fstream include vector include list include a

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <iostream>
#include <fstream>
#include <vector>
#include <list>
#include <algorithm>
using namespace std;
int main() {
ifstream in("input.txt");
if (in) {
vector<int> v;
int x;
while (in >> x) v.push_back(x);
cout << "Введите искомое число:";
cin >> x;
int how_much = count(v.begin(), v.end(), x);
cout << how_much << endl;
list<int> pos_list;
vector<int>::iterator pos = v.begin();
while (1) {
pos = find(pos, v.end(), x);
if (pos == v.end()) break;
pos_list.push_back((int) (pos - v.begin()));
pos++;
}
list<int>::iterator i;
for (i = pos_list.begin(); i != pos_list.end(); ++i)
cout << *i << " ";
return 0;
}
return 1;
}