0_liprikon_0

миша_интервал

Jun 20th, 2021
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <iostream>
  3. #include <iomanip>
  4.  
  5. using namespace std;
  6.  
  7. const int N = 3;
  8.  void exchange(int a, int b, int* mass, int N, int M)
  9.  {
  10.  for (int i = 0; i < N; i++)
  11.  {
  12.  if ((mass[i] > a) && (mass[i] < b))
  13.  mass[i] = 0;
  14.  }
  15.  }
  16.  int main()
  17.  {
  18.  setlocale(LC_ALL, "Russian");
  19.  cout << "Гришин К.А. УМЛ-111 3 вариант\n";
  20.  
  21.  int a;
  22.  int b;
  23.  int x[N][M];
  24.  
  25.  cout << "A= ";
  26.  cin >> a;
  27.  cout << "B= ";
  28.  cin >> b;
  29.  
  30.  for (i = 0; i < N; i++)
  31.      {
  32.        for (j = 0; j < M; j++)
  33.           {
  34.              cin >> [i][j];
  35.              cout << setw(6) << left << x[i][j];
  36.           } cout << endl;
  37.         }
  38.  
  39. for (int i = 0; i < N; i++)
  40.  {
  41.  exchange(a, b, x, N, M);
  42.  }
  43.  cout << endl;
  44.  
  45. for (int i = 0; i < N; i++)
  46.  {
  47.     for (int j = 0; j<M; j++)
  48.     {
  49.          cout << setw(4) << x[i][j] << " ";
  50.     }
  51.  }
  52.  
  53.  system("PAUSE");
  54.  return 0;
  55.  }
Advertisement
Add Comment
Please, Sign In to add comment