Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int rows = 0, cols = 0, arr[SIZE3][SIZE3] = { 0 }, i = 0, j = 0;
- int max1 = 0, max2 = 0, max3 = 0, max4 = 0;
- cout << " please enter the numbers of rows (between1-10) : ";
- cin >> rows;
- while (rows > 10 || rows < 1)
- {
- cout << "Value should be between 1-10, please try again : ";
- cin >> rows;
- }
- cout << " please enter the numbers of cols (between1-10) : ";
- cin >> cols;
- while (cols > 10 || cols < 1)
- {
- cout << "Value should be between 1-10, please try again : ";
- cin >> cols;
- }
- cout << "enter " << rows*cols << " numbers please : ";
- for (i = 0; i < rows; i++)
- {
- for (j = 0; j < cols; j++)
- {
- cin >> arr[i][j];
- }
- }
- for (i = 0; i < rows; i++)
- {
- for (j = 0; j < cols; j++)
- {
- cout << arr[i][j] << " ";
- }
- cout << endl;
- }
- max1 = arr[0][0];
- for (i = 0, j = 1; j < cols; j++)
- {
- if (arr[i][j] > max1)
- max1 = arr[i][j];
- }
- max2 = arr[rows - 1][0];
- for (i = rows - 1, j = 0; j < cols; j++)
- {
- if (arr[i][j] > max1)
- max1 = arr[i][j];
- }
- max3 = arr[0][cols - 1];
- for (i = 0, j = cols - 1; i < rows; i++)
- {
- if (arr[i][j] > max1)
- max1 = arr[i][j];
- }
- max4 = arr[0][0];
- for (i = 0, j = 0; i < rows; i++)
- {
- if (arr[i][j] > max1)
- max1 = arr[i][j];
- }
- cout << "the higher number on the fram is " << max1 << endl;
- break;
- system("pause");
- system("cls");
Advertisement
Add Comment
Please, Sign In to add comment