/
vlad777
/
Ivanov
Обзор
Документация
Войти
/
vlad777
/
Ivanov
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
calculator.cpp
53 строки
1 KB
vlad777
upload files
07 май 2025, 13:33
07 май 2025, 13:33
4be374a
Код
Авторство
О чём код?
#include <iostream> #include <math.h> #include <cmath> #include <windows.h> using namespace std; class Calculaor { public: int a; int b; int result; void Numbers() { } void Calc_sum() { this -> result = this -> a + this -> b; } void Calc_subtract() { this -> result = this -> a - this -> b; } void Calc_multiply() { this -> result = this -> a * this -> b; } void Calc_divide () { if(this-> b == 0){ cout << "Нет ответа" << endl; this->result = 0; } else this -> result = this -> a / this -> b; } }; int main() { setlocale(LC_ALL, "Russian"); Calculaor calculator; calculator.Numbers(); calculator.Calc_sum(); cout << "\n Сложение: " << calculator.result << endl; calculator.Calc_subtract(); cout << "\n Разность: " << calculator.result << endl; calculator.Calc_multiply(); cout << "\n Умножение: " << calculator.result << endl; calculator. Calc_divide(); cout << "\n Деление: " << calculator.result << endl; return 0; }