Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <locale.h>
- void inputVector(float* x) {
- for (int i = 0; i < 2; i++)
- std::cin >> x[i];
- }
- float getMin(float* x) {
- if (x[0] < x[1]) {
- return x[0];
- }
- else {
- return x[1];
- }
- }
- float calcScl(float* x, float* y) {
- return x[0] * y[0] + x[1] * y[1];
- }
- void main() {
- setlocale(LC_CTYPE, "RUSSIAN");
- float x[2], y[2], z[2];
- float* a[3];
- std::cout << "Введите (координаты через пробел) x: ";
- inputVector(x);
- std::cout << "Введите y: ";
- inputVector(y);
- std::cout << "Введите z: ";
- inputVector(z);
- if (getMin(x) > getMin(y) && getMin(x) > getMin(z)) {
- a[0] = x;
- a[1] = y;
- a[2] = z;
- }
- if (getMin(y) > getMin(x) && getMin(y) > getMin(z)) {
- a[0] = y;
- a[1] = x;
- a[2] = z;
- }
- if (getMin(z) > getMin(y) && getMin(z) > getMin(x)) {
- a[0] = z;
- a[1] = x;
- a[2] = y;
- }
- std::cout << "(a, a) - (b, c) = " << (calcScl(a[0], a[0]) - calcScl(a[1], a[2])) << '\n';
- std::cin >> a[0][0];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement