SHARE
TWEET

Untitled

a guest Nov 15th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void zad6()
  2. {
  3.     const int iSize = 15;
  4.     int A[iSize];
  5.     cout << "ВВЕДИТЕ МАССИВ: " << endl;
  6.     for(int i=0; i<iSize; i++)
  7.     {
  8.         cout << i+1 << ". ";
  9.         cin >> A[i];
  10.     }
  11.     float fMedian = 0.0;
  12.     for (int i=0; i!=iSize; i++)
  13.         fMedian += A[i];
  14.     fMedian /= iSize;
  15.     std::cout << "Median = " << fMedian << "\r\nB[]=\r\n";
  16.     float B[iSize];
  17.     for (int i=0; i!=iSize; i++)
  18.     {
  19.         B[i] = A[i]- fMedian;
  20.         std::cout <<    B[i] << "\r\n";
  21.     }
  22.     std::cout << "\r\nPress Enter To Exit...";
  23.     getchar();
  24.  
  25. }
  26. void zad7()
  27. {
  28.     const int SIZE = 14;
  29.     int arr[SIZE];
  30.  
  31.     for (int i = 0; i < SIZE; i++)
  32.     {
  33.         cout << " arr[" << i << "] = ";
  34.         cin >> arr[i];
  35.     }
  36.  
  37.     for (int i = 0; i < SIZE; i++)
  38.         cout << " " << arr[i];
  39.     cout << endl;
  40.  
  41.     int count = 0;
  42.     int sum = 0;
  43.  
  44.     for (int i = 0; i < SIZE; i++)
  45.         if (arr[i] % 2 == 0 && arr[i]>0) { // если элемент четный и положительный
  46.             count++;
  47.             sum += arr[i];
  48.         }
  49.  
  50.     cout << " count : " << count << endl;
  51.     cout << " sum : " << sum << endl;
  52. }
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