/
MorningKoffe
/
TechStorage
Обзор
Документация
Войти
/
MorningKoffe
/
TechStorage
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Smartphone.cpp
29 строк
1 KB
Tsidik Vitaliy
init
06 июн 2026, 11:03
06 июн 2026, 11:03
6cdcdf7
Код
Авторство
О чём код?
#include "Smartphone.h" #include <sstream> #include <iomanip> Smartphone::Smartphone(string name, string brand, double price, int stock, bool battery, int hours, string os, int camera, int ram) : IElectronicDevice(std::move(name), std::move(brand), price, stock), Portable(battery, hours), os_(std::move(os)), cameraMP_(camera), ramGB_(ram) {} string Smartphone::getName() const { return name_; } string Smartphone::getBrand() const { return brand_; } double Smartphone::getPrice() const { return price_; } int Smartphone::getStock() const { return stock_; } string Smartphone::getDetails() const { ostringstream oss; oss << fixed << setprecision(2); return "Smartphone: " + name_ + "\n" "Brand: " + brand_ + "\n" "Price: " + to_string(price_) + "\n" "Stock: " + to_string(stock_) + "\n" "OS: " + os_ + "\n" "Camera: " + to_string(cameraMP_) + "MP\n" "RAM: " + to_string(ramGB_) + "GB\n" "Power: " + getPowerType(); }