Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////////////////////////////////////////////////////////////////////////
- // Задачата намира минималният елемент за всяка колона и го изписва под нея. //
- //////////////////////////////////////////////////////////////////////////////
- #include <iostream>
- #include <ctime>
- using namespace std;
- int main() {
- srand(time(0));
- int matrix[2][7];
- int min_by_column[7];
- for (size_t i = 0; i < 2; i++) {
- for (size_t j = 0; j < 7; j++) {
- matrix[i][j] = rand() % (9 - 1);
- }
- }
- for (size_t i = 0; i < 2; i++) {
- for (size_t j = 0; j < 7; j++) {
- min_by_column[j] = matrix[0][j];
- cout << matrix[i][j] << " ";
- if(min_by_column[j] > matrix[i][j])
- min_by_column[j] = matrix[i][j];
- }
- cout << endl;
- }
- for (size_t i = 0; i < 7; i++) {
- cout << min_by_column[i] << " ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement