Advertisement
Courbe_Impliquee

Двойной массив

Dec 20th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <clocale>
  4. using namespace std;
  5. int main()
  6. {
  7. setlocale(LC_ALL, "rus");
  8. int n,m, k,t,sum=0,max;
  9. bool flag = 1;
  10. cout << "Введите кол-во строк и столбцов матрицы: ";
  11. cin >> n >> m;
  12. cout << endl;
  13. int** arr = new int *[n];
  14. for (int i = 0; i < n; ++i)
  15. arr[i] = new int[m];
  16. cout << "Введите элементы матрицы:"<<endl;
  17. for (int i = 0; i < n; i++){
  18. for (int j = 0; j < m; j++){
  19. cin >> arr[i][j];
  20. }
  21. }
  22. cout << endl;
  23. t = m;
  24. for (int j = 0; j < m; j++){
  25. for (int i = 0; i < n; i++){
  26. if (arr[i][j] == 0){
  27. t--;
  28. continue;
  29. }
  30. }
  31. }
  32. for (int i=0,j = 0; j < m-1 && i<n-1; i++,j++){
  33. if (arr[i][j] % 2 == 0 && arr[i][j]>=0){
  34. sum += arr[i][j];
  35. }
  36. max = sum;
  37. if ()
  38. }
  39. cout <<"Кол-во столбцов без нулей: "<< t << endl;
  40. system("pause");
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement