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_row[2];
- 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++) {
- min_by_row[i] = matrix[i][0];
- for (size_t j = 0; j < 7; j++) {
- cout << matrix[i][j] << " ";
- if(min_by_row[i] > matrix[i][j])
- min_by_row[i] = matrix[i][j];
- }
- cout << min_by_row[i] << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement