Advertisement
JewishCat

Ykaz_23v

Dec 21st, 2015
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. /*
  7.  *
  8.  */
  9. void ykaz(int *mas,int a);
  10.  
  11. int main() {
  12.    
  13.     void (*ptr)(int *mas,int a);
  14.     ptr=ykaz;
  15.     int a;
  16.     int *b = new int;
  17.     cout << "Kol-vo chisel: ";
  18.     cin >> a;
  19.     for (int i = 0; i < a; i++) {
  20.     cout << "Vvedite chislo: ";
  21.     cin >> b[i];
  22.     }
  23.     ptr(b,a);
  24.     return 0;
  25. }
  26. void ykaz(int *mas,int a){
  27.     int c[4] = { 0,0,0,0 };
  28.     for (int i = 0; i < a; i++) {
  29.     if ((mas[i] % 3) == 0) {
  30.             c[0]++;
  31.     }
  32.     }
  33.     for (int i = 0; i < a; i++) {
  34.     if ((mas[i] % 5) == 0) {
  35.             c[1]++;
  36.     }
  37.     }
  38.     for (int i = 0; i < a; i++) {
  39.     if ((mas[i] % 7) != 0) {
  40.             c[2]++;
  41.     }
  42.     }
  43.     for (int i = 0; i < a; i++) {
  44.     if ((mas[i] % 9) == 1) {
  45.             c[3]++;
  46.     }
  47.     }
  48.     cout << c[0] << c[1] << c[2] << c[3] << endl;    
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement