Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. double NUMB_COLS = 3;
  4.  
  5. void readMatrix(int matr[] [3], int numb_rows, int numb_cols)
  6. {
  7. for (int i = 0; i<numb_rows; i++)
  8. {
  9. for (int j = 0; j < numb_cols; j++)
  10. {
  11. cout <<"[" << i << "] [" <<j <<"] =";
  12. cin >> matr[i][j];
  13. }
  14. }
  15. }
  16. void printMatr(int matr[][3], int numb_rows, int numb_cols)
  17. {
  18. for (int i = 0; i < numb_rows; i++)
  19. {
  20. for (int j = 0; j < numb_cols; j++)
  21. {
  22. cout << "[" << i << "][" << j << "] = " << matr[i][j];
  23. }
  24. cout << endl;
  25. }
  26. }
  27. int main()
  28. {
  29. int matr[5][10];
  30. printMatr(matr, 4, 5);
  31. readMatrix(matr, 4, 5);
  32. return 0;
  33. }
  34.  
  35. void readMatrix(int numb_rows, int numb_cols, int matr[numb_rows][numb_cols]) {
  36.  
  37. void readMatrix(int matr[5][10], int numb_rows, int numb_cols)
  38.  
  39. int matr[5][10];
  40.  
  41. int matr[][3]
  42.  
  43. int matr[][10];
  44.  
  45. void printMatr(int matr[][10], int numb_rows, int numb_cols)
  46.  
  47. int matr[5][3];
  48. printMatr(matr, 5, 3);
  49. readMatrix(matr, 5, 3);
  50.  
  51. double NUMB_COLS = 3;
  52.  
  53. const int NUMB_COLS = 3;
  54.  
  55. #include<iostream>
  56. using namespace std;
  57.  
  58. const int NUMB_COLS = 3;
  59.  
  60. void readMatrix(int matr[] [NUMB_COLS], int numb_rows, int numb_cols)
  61. {
  62. for (int i = 0; i<numb_rows; i++)
  63. {
  64. for (int j = 0; j < numb_cols; j++)
  65. {
  66. cout <<"[" << i << "] [" <<j <<"] =";
  67. cin >> matr[i][j];
  68. }
  69. }
  70. }
  71. void printMatr(int matr[][NUMB_COLS], int numb_rows, int numb_cols)
  72. {
  73. for (int i = 0; i < numb_rows; i++)
  74. {
  75. for (int j = 0; j < numb_cols; j++)
  76. {
  77. cout << "[" << i << "][" << j << "] = " << matr[i][j];
  78. }
  79. cout << endl;
  80. }
  81. }
  82.  
  83. int main()
  84. {
  85. int matr[5][NUMB_COLS];
  86.  
  87. printMatr(matr, 5, NUMB_COLS);
  88. readMatrix(matr, 5, NUMB_COLS);
  89.  
  90. return 0;
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement