0% found this document useful (0 votes)
4 views2 pages

File Based Inventory Management System Microproject

The document contains a C++ code snippet for managing an inventory system with a structure for products. It includes a function to add a product to an inventory file, capturing details like ID, name, quantity, and price. Additional functions are mentioned for displaying, searching, updating, and deleting products, but are not implemented in the provided code.

Uploaded by

aryantelang264
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

File Based Inventory Management System Microproject

The document contains a C++ code snippet for managing an inventory system with a structure for products. It includes a function to add a product to an inventory file, capturing details like ID, name, quantity, and price. Additional functions are mentioned for displaying, searching, updating, and deleting products, but are not implemented in the provided code.

Uploaded by

aryantelang264
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

#include #include #include #include using namespace std; struct

Product { int id; char name[30]; int quantity; float price; }; void
addProduct() { Product p; ofstream fout("inventory.txt", ios::app
| ios::binary); cout << "\nEnter Product ID: "; cin >> p.id; cout
<< "Enter Product Name: "; cin.ignore(); cin.getline(p.name, 30);
cout << "Enter Quantity: "; cin >> p.quantity; cout << "Enter
Price: "; cin >> p.price; fout.write((char*)&p;, sizeof(p));
fout.close(); cout << "\n■ Product Added Successfully!\n"; } //
Other functions: displayAll(), searchProduct(), updateProduct(),
deleteProduct()

You might also like