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