/
Puzzman
/
basic_programming
Обзор
Документация
Войти
/
Puzzman
/
basic_programming
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
course_project_2/Lib/Air/MagicCarpet/MagicCarpet.cpp
30 строк
724 B
Puzzanis
algo homework 1-2 added
28 сен 2024, 10:23
28 сен 2024, 10:23
2108435
Код
Авторство
О чём код?
#include "MagicCarpet.h" float MagicCarpet::movement(const int& distance) { float res_distance{0.0}; float res_time{ 0.0 }; if (distance < 1000) { res_distance += distance; } else if (distance >= 1000 && distance < 5000) { res_distance += distance*0.97; } else if (distance >= 5000 && distance < 10000) { res_distance += distance * 0.90; } else { res_distance += distance * 0.95; } res_time = res_distance / speed_; last_race_ = res_time; return res_time; } MagicCarpet::MagicCarpet() { name_ = "����-������"; speed_=10; } std::string& MagicCarpet::get_name() { return name_; } int MagicCarpet::get_type() const { return type_; }; float MagicCarpet::get_last_race() const { return last_race_; };