Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int sumAB = 0, sumBC = 0, sumCA = 0;
- int a[3],
- b[3],
- c[3];
- cout << "Massiv one: ";
- for(int i = 0; i <= 2; i++)
- {
- a[i] = rand() % 20;
- cout << a[i] << " ";
- }
- cout << endl;
- cout << "Massiv two: ";
- for(int i = 0; i <= 2; i++)
- {
- b[i] = rand() % 20;
- cout << b[i] << " ";
- }
- cout << endl;
- cout << "Massiv three: ";
- for(int i = 0; i <= 2; i++)
- {
- c[i] = rand() % 20;
- cout << c[i] << " ";
- }
- cout << endl;
- for(int A = 0; A <= 2; A++)
- {
- sumAB += a[A] * b[A];
- sumBC += b[A] * c[A];
- sumCA += c[A] * a[A];
- }
- cout << "Скалярное произведение AB: " << sumAB << endl;
- cout << "Скалярное произведение BC: " << sumBC << endl;
- cout << "Скалярное произведение CA: " << sumCA << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement