Advertisement
Guest User

Lab4Mesnankin

a guest
Dec 5th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <ctime>
  4. using namespace std;
  5.  
  6. void main()
  7. {
  8.     srand(time(NULL));
  9.     int a[10][10];
  10.     cout << "Here is random array size 10*10\n";
  11.     for (int i = 0; i < 10; i++)
  12.         for (int j = 0; j < 10; j++)
  13.             a[i][j] = rand() % 2;
  14.     for (int i = 0; i < 10; i++) {
  15.         for (int j = 0; j < 10; j++) {
  16.             cout << a[i][j] << " ";
  17.         }
  18.         cout << endl;
  19.     }
  20.     int SC = 0;
  21.     for (int i = 0; i < 10; i++)
  22.         for (int j = 0; j < 10; j++) {
  23.             if ((i = j) && (a[i][j] * a[i][j] == 1))
  24.                 SC = SC + 1;
  25.             if ((i != j) && (a[i][j] * a[j][i] == 0))
  26.                 SC = SC + 1;
  27.         }
  28.     if (SC == 100)
  29.         cout << "Array is orhonormal";
  30.     else
  31.         cout << "Array is not othonormal";
  32.     system("pause");
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement