Created
November 9, 2022 19:57
-
-
Save SPACE-DOGGO/3a76007486ed4b05c2ce40eebca3c043 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| //struct ComplexNumber | |
| //{ | |
| //public: | |
| // ComplexNumber(); | |
| // ComplexNumber(double a, double b); | |
| // ComplexNumber plus(ComplexNumber&); | |
| // ComplexNumber minus(ComplexNumber&); | |
| // ComplexNumber multiply(ComplexNumber&); | |
| // ComplexNumber divide(ComplexNumber&); | |
| // void print(); | |
| // void setA(double a); | |
| // void setB(double b); | |
| // void read(); | |
| //private: | |
| // double a, b; | |
| //}; | |
| // | |
| //ComplexNumber::ComplexNumber() | |
| //{ | |
| // a = 0; | |
| // b = 0; | |
| //} | |
| // | |
| //ComplexNumber::ComplexNumber(double a, double b) | |
| //{ | |
| // this->a = a; | |
| // this->b = b; | |
| //} | |
| // | |
| //void ComplexNumber::setA(double a) | |
| //{ | |
| // this->a = a; | |
| //} | |
| // | |
| //void ComplexNumber::setB(double b) | |
| //{ | |
| // this->b = b; | |
| //} | |
| // | |
| //void ComplexNumber::read() | |
| //{ | |
| // cout << "Введите вещественную часть: "; | |
| // cin >> a; | |
| // cout << "Введите мнимую часть: "; | |
| // cin >> b; | |
| //} | |
| // | |
| //void ComplexNumber::print() | |
| //{ | |
| // cout << a << (b > 0 ? "+" : "") << b << "*i\n"; | |
| //} | |
| // | |
| //ComplexNumber ComplexNumber::plus(ComplexNumber& right) | |
| //{ | |
| // return ComplexNumber(this->a + right.a, this->b + right.b); | |
| //} | |
| // | |
| //ComplexNumber ComplexNumber::minus(ComplexNumber& right) | |
| //{ | |
| // return ComplexNumber(this->a - right.a, this->b - right.b); | |
| //} | |
| // | |
| //ComplexNumber ComplexNumber::multiply(ComplexNumber& right) | |
| //{ | |
| // double a = this->a, | |
| // b = this->b, | |
| // c = right.a, | |
| // d = right.b; | |
| // return ComplexNumber(a * c - b * d, b * c + a * d); | |
| //} | |
| // | |
| //ComplexNumber ComplexNumber::divide(ComplexNumber& right) | |
| //{ | |
| // double a = this->a, | |
| // b = this->b, | |
| // c = right.a, | |
| // d = right.b; | |
| // double resultA = (a * c + b * d) / (c * c + d * d); | |
| // double resultB = (b * c - a * d) / (c * c + d * d); | |
| // return ComplexNumber(resultA, resultB); | |
| //} | |
| // | |
| //int menu() | |
| //{ | |
| // int answer; | |
| // cout << "\n1 - Сложить\n" | |
| // << "2 - Вычесть\n" | |
| // << "3 - Умножить\n" | |
| // << "4 - Разделить\n" | |
| // << "0 - Выход из программы\n"; | |
| // | |
| // cin >> answer; | |
| // cout << "\n"; | |
| // return answer; | |
| //} | |
| // | |
| //int main() | |
| // { | |
| // setlocale(0, "UKR"); | |
| // ComplexNumber a, b, result; | |
| // int answer; | |
| // do { | |
| // answer = menu(); | |
| // if (answer != 0) { | |
| // cout << "Число А\n"; | |
| // a.read(); | |
| // cout << "Число B\n"; | |
| // b.read(); | |
| // } | |
| // switch (answer) { | |
| // case 0: | |
| // break; | |
| // case 1: | |
| // result = a.plus(b); | |
| // break; | |
| // case 2: | |
| // result = a.minus(b); | |
| // break; | |
| // case 3: | |
| // result = a.multiply(b); | |
| // break; | |
| // case 4: | |
| // result = a.divide(b); | |
| // break; | |
| // } | |
| // if (answer != 0) { | |
| // cout << "Результат: "; | |
| // result.print(); | |
| // } | |
| // } while (answer != 0); | |
| //} | |
| struct Automobile | |
| { | |
| int length; // Длина | |
| int clearance; // Клиренс | |
| int landingHeight; // Высота посадки | |
| int potencia; // Объем двигателя | |
| int enginePower; // Мощность двигателя | |
| int diameterOfWheels; // Диаметр колес | |
| string color; // Цвет | |
| string transmissionType; // Тип коробки передач | |
| }; | |
| Automobile InputCar(Automobile& car) | |
| { | |
| cout << "Длина: " << "\n"; | |
| cin >> car.length; | |
| cout << "Клиренс: " << "\n"; | |
| cin >> car.clearance; | |
| cout << "Высота посадки: " << "\n"; | |
| cin >> car.landingHeight; | |
| cout << "Объем двигателя: " << "\n"; | |
| cin >> car.potencia; | |
| cout << "Мощность двигателя: " << "\n"; | |
| cin >> car.enginePower; | |
| cout << "Диаметр колес: " << "\n"; | |
| cin >> car.diameterOfWheels; | |
| cout << "Цвет: " << "\n"; | |
| cin >> car.color; | |
| cout << "Тип коробки передач: " << "\n"; | |
| cin >> car.transmissionType; | |
| return car; | |
| } | |
| void outputCar(Automobile car) | |
| { | |
| cout << "\n"; | |
| cout << "Длина: " << car.length << "\n"; | |
| cout << "Клиренс: " << car.clearance << "\n"; | |
| cout << "Высота посадки: " << car.landingHeight << "\n"; | |
| cout << "Объем двигателя: " << car.potencia << "\n"; | |
| cout << "Мощность двигателя: " << car.enginePower << "\n"; | |
| cout << "Диаметр колес: " << car.diameterOfWheels << "\n"; | |
| cout << "Цвет: " << car.color << "\n"; | |
| cout << "Тип коробки передач: " << car.transmissionType << "\n"; | |
| cout << "\n"; | |
| } | |
| int main() | |
| { | |
| setlocale(0, "UKR"); | |
| Automobile car; | |
| InputCar(car); | |
| outputCar(car); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment