Advertisement
Kyal

Untitled

Dec 16th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.38 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void citire_matrice(int a[100][100], int n, int m) {
  6.  
  7.  for (int i = 1; i <= n; i++) {
  8.  
  9.   for (int j = 1; j <= m; j++) {
  10.  
  11.    cout << "a[" << i << "][" << j << "] : ";
  12.  
  13.    cin >> a[i][j];
  14.  
  15.   }
  16.  
  17.  }
  18.  
  19. }
  20.  
  21. void afisare_matrice(int a[100][100], int n, int m) {
  22.  
  23.  for (int i = 1; i <= n; i++) {
  24.  
  25.   for (int j = 1; j <= m; j++) {
  26.  
  27.    cout << a[i][j] << " ";
  28.  
  29.   }
  30.  
  31.   cout << endl;
  32.  
  33.  }
  34.  
  35. }
  36.  
  37. void afisareculinie_matrice(int a[100][100], int n, int m,int l1) {
  38.  
  39.  int s = 0, min, max;
  40.  
  41.  min = a[l1][1];
  42.  
  43.  max = a[l1][1];
  44.  
  45.   for (int i = 1; i <= n; i++) {
  46.  
  47.    s = s + a[i][l1];
  48.  
  49.    if (a[i][l1] > max)
  50.  
  51.     max = a[i][l1];
  52.  
  53.    if (a[i][l1] <min)
  54.  
  55.     min = a[i][l1];
  56.  
  57.   
  58.  
  59.   }
  60.  
  61.   for (int i = 1; i <= n; i++) {
  62.  
  63.    for (int j = 1; j <= m; j++) {
  64.  
  65.     cout << a[i][j] << " ";
  66.  
  67.    }
  68.  
  69.    cout << endl;
  70.  
  71.   }
  72.  
  73.   n + 1;
  74.  
  75.   cout << s << " " << min << " " << max;
  76.  
  77.  }
  78.  
  79. int main() {
  80.  
  81.  int M[100][100], n, m, l1;
  82.  
  83.  cout << "Numarul liniilor : "; cin >> n;
  84.  
  85.  cout << "Numarul coloanelor : "; cin >> m;
  86.  
  87.  citire_matrice(M, n, m);
  88.  
  89.  afisare_matrice(M, n, m);
  90.  
  91.  cout << endl;
  92.  
  93.  cout << "Coloana : ";
  94.  
  95.  cin >> l1;
  96.  
  97.  cout << endl;
  98.  
  99.  afisareculinie_matrice(M, n, m, l1);
  100.  
  101.  system("pause");
  102.  
  103. }
  104.  
  105. Citește mai multe pe Brainly.ro - https://brainly.ro/tema/5630866#readmore
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement