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