Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.98 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int main()
  5. {
  6.   int sumAB = 0, sumBC = 0, sumCA = 0;
  7.   int a[3],
  8.     b[3],
  9.     c[3];
  10.     cout << "Massiv one: ";
  11.     for(int i = 0; i <= 2; i++)
  12.     {
  13.         a[i] = rand() % 20;
  14.         cout << a[i] << " ";
  15.      }
  16.     cout << endl;
  17.  
  18.     cout << "Massiv two: ";
  19.     for(int i = 0; i <= 2; i++)
  20.     {
  21.         b[i] = rand() % 20;
  22.         cout << b[i] << " ";
  23.     }
  24.     cout << endl;
  25.  
  26.     cout << "Massiv three: ";
  27.     for(int i = 0; i <= 2; i++)
  28.     {
  29.         c[i] = rand() % 20;
  30.         cout << c[i] << " ";
  31.     }
  32.     cout << endl;
  33.    
  34.     for(int A = 0; A <= 2; A++)
  35.     {
  36.         sumAB += a[A] * b[A];
  37.         sumBC += b[A] * c[A];
  38.         sumCA += c[A] * a[A];
  39.     }
  40.  
  41.     cout << "Скалярное произведение AB: " << sumAB << endl;
  42.     cout << "Скалярное произведение BC: " << sumBC << endl;
  43.     cout << "Скалярное произведение CA: " << sumCA << endl;
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement