Guest User

zadanie2lab10

a guest
Nov 8th, 2015
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. // lab10z2.cpp: определяет точку входа для консольного приложения.
  2. //
  3.  
  4. #include "stdafx.h"
  5.  
  6.  
  7. #include <iostream>
  8. #include <algorithm>
  9.  
  10. using namespace std;
  11. int C, arr[10], *arrp = &arr[10];
  12. void fill ()
  13. {
  14.     int  i;
  15.         cout << "Enter the numbers of array" << '\n';
  16.         for (i=0; i<10; i++)
  17.         {
  18.             cout <<  "arr[" << i << "] = ";
  19.             cin >> *(arrp+i);
  20.         }
  21.        
  22. }
  23.  
  24. void count ()
  25. {
  26.     int i;
  27.         for ( i=0; i < 10 ; i++)
  28.         {
  29.             if (*(arrp+i)>8)
  30.             {
  31.                 C++;
  32.             }
  33.         }
  34.        
  35. }
  36.  
  37. void sorting ()
  38. {
  39.     std::sort(arrp, arrp+10);
  40.    
  41. }
  42. int main ()
  43. {
  44.     fill();
  45.     count();
  46.     sorting();
  47.     cout << '\n' << "The results of Sorting";
  48.         int  i;
  49.        
  50.         for (i=0; i<10; i++)
  51.         {
  52.             cout << '\n' << "arr[" << i << "] = " << *(arrp + i);
  53.            
  54.         }
  55.        
  56.         cout << '\n' << '\n' << "Amount of numbers more than 8 = " << C << '\n';
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment