//Header files
#include<iostream>
#include<cstring>
//Namespace used
using namespace std;
//Structure definition[store]
struct store
{
int p_id;
char p_name[100];
int quantity;
float price;
float amount;
};
// [display function] to display product details
int display(struct store s)
{
cout<<"Product id is:"<<s.p_id<<endl;
cout<<"Name of the Product is:"<<s.p_name<<endl;
cout<<"Total quantity of the book:"<<s.quantity<<endl;
cout<<"Total price :"<<s.price<<endl;
cout<<"Total Amount:"<<s.amount;
return 0;
}
//Main function
int main()
{
// creating an instance of struct store
struct store s1,s2,s3,s4;
s1.p_id=10002;
//using strcpy function
strcpy(s1.p_name,"ABC");
s1.quantity=200;
s1.price=12;
s1.amount=s1.quantity*s1.price;
display(s1);
cout<<"\n\n";
s2.p_id=10003;
//using strcpy function
strcpy(s2.p_name,"XYZ");
s2.quantity=300;
s2.price=13;
s2.amount=s2.quantity*s2.price;
display(s2);
return 0;
}