Draw a flowchart, write an algorithm and design a C++ program for an inventory system that will alert the user to reorder an item based on:
a. The stock-on-hand or an order is below the reorder print.
b. The item is not obsolete.
Use the selection structure.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
struct date{
int day;
int month;
int year;
};
struct details{
char name[20];
int price;
int code;
int qty;
struct date mfg;
};
struct details items[50];
int n,i;
cout << "Enter the number of items" << endl;
cin>>n;
for(i=0;i<n;i++){
cout<<"Item name: \n";
cin>>items[i].name;
cout<<"Item code: \n";
cin>>items[i].code;
cout<<"Item quantity: \n";
cin>>items[i].qty;
cout<<"Item price: \n";
cin>>items[i].price;
cout<<"Item manufucturing date: \n";
cin>>items[i].mfg.day,items[i].mfg.month,items[i].mfg.year;
}
cout<<"*****Inventory*********\n";
cout<<"S.N |Name |Code | Quantity | Price| mfg date\n";
cout<<"-----------------------------------";
for(i=0;i<n;i++){
cout<<(i+1)<<setw(5)<<items[i].name<<setw(7)<<items[i].code<<setw(7)<<items[i].qty<<setw(7)<<items[i].price<<setw(7)<<items[i].mfg.day,items[i].mfg.month,items[i].mfg.year;
}
}
Comments
Leave a comment