Answer to Question #279492 in C++ for Alunsina

Question #279492

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 point

b.     The item is not obsolete

Use the selection structure



1
Expert's answer
2021-12-14T07:02:44-0500
#include <bits/stdc++.h>
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;
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog