SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. int count_elements(int c, int *b, int size){
  4.     int count = 0;
  5.     for(int i = 0; i < size; i++)
  6.         if(b[i] > c) count++;
  7.     return count;
  8. }
  9.  
  10. int main() {
  11.     int size = 0;
  12.     std::cout << "Enter size of array: ";
  13.     std::cin >> size;
  14.     int* b = new int[size];
  15.     for(int i = 0; i < size; i++){
  16.         std::cout << "Enter array element " << i << ": ";
  17.         std::cin >> b[i];
  18.     }
  19.     int c;
  20.     std::cout << "Enter c: ";
  21.     std::cin >> c;
  22.     int result = count_elements(c,b,size);
  23.     std::cout << "Result: " << result << std::endl;
  24.     delete [] b;
  25.     return 0;
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top