DSA_Filehandling
DSA_Filehandling
Data Description
The file "inventory.csv" contains product information for a computer store. The initial lines of the file
appear as:
ProductID , Category , CPU , GPU , RAM , Storage , Price , Stock
COM001 , Laptop , i7 -10750 H , RTX3060 ,16 GB ,512 GB SSD ,1200 ,10
COM002 , Desktop , Ryzen 5 3600 , GTX1660 Super ,32 GB ,1 TB HDD ,800 ,5
COM003 , Laptop , , , ,600 , ,8
COM004 , Monitor , , , ,250 ,15
COM005 , Desktop , i5 -10400 , UHD 630 ,16 GB ,512 GB NVMe ,700 ,3
Where:
Programming Requirements
Given the Product structure definition:
// Product . h
struct Product {
string productID ;
string category ;
string cpu ;
string gpu ;
string ram ;
string storage ;
float price ;
int stock ;
float inventoryValue ;
string components ;
};
1
2. Read Product List
Sample Output
ID Category InventoryValue Components
COM001 Laptop 12000 CPU : i7 -10750 H ; GPU : RTX3060 ; RAM :16 GB ; Storage :512 GB SSD
COM003 Laptop 0 CPU : N / A ; GPU : N / A ; RAM : N / A ; Storage : N / A
COM005 Desktop 2100 CPU : i5 -10400; GPU : UHD 630; RAM :16 GB ; Storage :512 GB NVMe