Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- setlocale(0, "");
- int n = 0, a = 0, d = 0;
- cout << "Введiть розмiр масиву: ";
- cin >> n;
- int* arr = new int[n];
- for (int i = 0; i < n; i++) {
- arr[i] = rand() % 27;
- }
- for (int i = 0; i < n; i++) {
- cout << arr[i] << "\t";
- }
- int element;
- cout << "\nВведiть елемент для пошуку: ";
- cin >> element;
- int count = 0;
- for (int i = 0; i < n; i++) {
- if (arr[i] == element) {
- count++;
- }
- }
- cout << "\nЕлементiв " << element << " = " << count << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment