25 Feb 2017

inlab 5 - CSE1002

 Tick option "Request desktop site" while using mobile device, or else code formating may be disturbed.


Code:

void item::get(){
    cin>>prod_name>>prod_code>>prod_price>>stock_In_Hand;}
void item::print() const{
cout<<prod_name<<"\n"<<prod_code<<"\n"<<prod_price<<"\n"<<stock_In_Hand<<"\n";}
void store::get_details(){ cin>>num_Of_Items;
    for(int i=0;i<num_Of_Items;items[i++].get());}
void store_keeper::stock_mgmt(store &a){
    for(int i=0;i<a.num_Of_Items;i++)

    if(a.items[i].stock_In_Hand<10) a.items[i].print();}

Input:

n (number of products)
next n lines contain:
    Name of the product
    Product code
    Price
    stock in hand

Output:

complete details of the product whose available stock is less than 10

Processing:

for i=1 till i=number of items
      if i'th item's stock<10
                output i'th item's details

Psuedocode:

start
input n
for i=1 till i=n
      input name,code,price,stock for i'th item
end for
for i=1 till i=n
      if i'th item's stock<10
                output i'th item's name, code, price, stock
      end if
end for
stop

1 comment: