Advertisement
Guest User

Untitled

a guest
May 25th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.98 KB | None | 0 0
  1. #include <fstream>
  2. #include <cmath>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. int main(void) {
  8.     fstream input;
  9.     fstream output;
  10.     output.open("output.txt", fstream::out);
  11.     double a[10][10];
  12.     for (size_t i = 1; i < 11; i++)
  13.     {
  14.         for (size_t j = 0; j < 11; j++)
  15.         {
  16.             a[i - 1][j - 1] = (10 - pow(j - 5, 2)) * pow(i - 5, 2);
  17.             cout << a[i - 1][j - 1] << " ";
  18.         }
  19.         cout << endl;
  20.     }
  21.     double b[10], c[10], k[10];
  22.     for (size_t i = 0; i < 10; i++)
  23.     {
  24.         b[i] = a[i][0];
  25.         for (size_t j = 1; j < 10; j++) if (b[i] > a[i][j]) b[i] = a[i][j];
  26.     }
  27.     for (size_t j = 0; j < 10; j++)
  28.     {
  29.         c[j] = a[0][j];
  30.         k[j] = 1;
  31.         for (size_t i = 1; i < 10; i++)
  32.         {
  33.             if (c[j]<a[i][j])
  34.             {
  35.                 c[j] = a[i][j];
  36.                 k[j] = i;
  37.             }
  38.         }
  39.     }
  40.     int d = 0;
  41.     for (size_t j = 0; j < 10; j++)
  42.     {
  43.         for (size_t i = 0; i < 10; i++)
  44.         {
  45.             if (b[j]==c[i] && j==k[i])
  46.             {
  47.                 output << j << "\n";
  48.                 output << i << "\n";
  49.                 output << c[i] << "\n";
  50.             }
  51.         }
  52.     }
  53.     output.close();
  54.     return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement