Untitled
unknown
plain_text
2 years ago
702 B
4
Indexable
#include <iostream> #include <fstream> #include <stdint.h> #include <algorithm> #include <string> #include "Header.h" using namespace std; int cumm(vector <int> j) { int s = 0; for (int i : j) { s += i; } return s; } int main() { setlocale(LC_ALL, "Russian"); int a = 0; vector <int> b; while (cin >> a && a!=0) { b.push_back(a); } vector <int> c; for (int i : b) { if (!count(c.begin(), c.end(), i)) { c.push_back(i); } } for (int i : c) { cout << "Число " << i << " встретилось " << count(b.begin(), b.end(), i) << " раз\n" ; } cout << "Всего " << b.size() << " чисел\n"; cout << "Сумма - " << cumm(b); }
Editor is loading...