Advertisement
Guest User

Задача №5

a guest
Dec 18th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "stdio.h"
  3. #include "conio.h"
  4. #include "math.h"
  5. #include "iostream"
  6.  
  7. using namespace System;
  8. using namespace std;
  9.  
  10. const int I = 3;
  11. const int J = 4;
  12.  
  13. void vvod(int A[I][J])
  14. {
  15.     int i, j;
  16.     for (i = 0; i < I; i++)
  17.     {
  18.         cout << "\n";
  19.         for (j = 0; j < J; j++)
  20.         {
  21.             cout << "A[" << i << "][" << j << "] = ";
  22.             cin >> A[i][j];
  23.         }
  24.     }
  25. }
  26.  
  27. int srednee(int A[I][J], int j)
  28. {
  29.     int i;
  30.     float sum = 0;
  31.     for (i = 0; i < I; i++)
  32.     {
  33.         sum = sum + A[i][j];
  34.     }
  35.     sum = sum / 3;
  36.     cout << sum << ", ";
  37. }
  38.  
  39. void main()
  40. {
  41.     int A[I][J];
  42.     vvod(A);
  43.     srednee(A, 0);
  44.     srednee(A, 1);
  45.     srednee(A, 2);
  46.     srednee(A, 3);
  47.     getch();
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement