/
MorningKoffe
/
TechStorage
Обзор
Документация
Войти
/
MorningKoffe
/
TechStorage
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
TechStorage.cpp
75 строк
2 KB
Tsidik Vitaliy
init
06 июн 2026, 11:03
06 июн 2026, 11:03
6cdcdf7
Код
Авторство
О чём код?
#include <iostream> #include <memory> #include <vector> #include "ElectronicDevice.h" #include "GamingLaptop.h" #include "Laptop.h" #include "Refrigerator.h" #include "Smartphone.h" #include "TV.h" int main(int argc, char* argv[]) { vector<unique_ptr<IElectronicDevice>> products; products.push_back(make_unique<Smartphone>( "iPhone 15", "Apple", 999.99, 10, true, 40, "iOS", 48, 8)); products.push_back(make_unique<Smartphone>( "Galaxy S24", "Samsung", 849.99, 15, true, 46, "Android", 50, 12)); products.push_back(make_unique<Laptop>( "MacBook Pro", "Apple", 2399.99, 5, true, 12, "M2", 512, 14)); products.push_back(make_unique<Laptop>( "XPS 15", "Dell", 1799.99, 8, true, 13, "Intel i7", 1024, 15.6)); products.push_back(make_unique<GamingLaptop>( "Alienware m16", "Dell", 2799.99, 3, true, 6, 350, "Intel i9", 1000, 16,"RTX 4070", 165)); products.push_back(make_unique<TV>( "NanoCell 85", "LG", 1499.99, 7, 550, 85, "4K", true)); products.push_back(make_unique<TV>( "OLED C3", "Sony", 1999.99, 4, 450, 65, "4K", true)); products.push_back(make_unique<Refrigerator>( "Frost Free", "Bosch", 899.99, 6, 750, 350, true, true)); products.push_back(make_unique<Refrigerator>( "Double Door", "Samsung", 749.99, 12, 800, 400, true, false)); int choice; do { cout << "\n=== TECH STORE ===\n"; cout << "Available products:\n"; for (size_t i = 0; i < products.size(); ++i) { cout << (i + 1) << ". " << products[i]->getName() << " (" << products[i]->getBrand() << ") - $" << std::fixed << std::setprecision(2) << products[i]->getPrice() << "\n"; } cout << "0. Exit\n"; cout << "Enter your choice: "; cin >> choice; if (choice > 0 && choice <= static_cast<int>(products.size())) { cout << "\n" << products[choice - 1]->getDetails() << "\n"; } } while (choice != 0); return 0; }