Solution/bin/Debug/Solution.exe
Solution/main.cpp
#include
#include
#include
#include
using namespace std;
// VEGETABLE SPECIFICATIONS
class Vegetable{
public :
string name; //NAME OF VEGETABLE
string color; //COLOR OF VEGETABLE
string type; //TYPE OF VEGETABLE
int protein_qty,carbs_qty,fats_qty,fibre_qty; //MEASUREMENTS OF VARIOUS NUTRIENTS IN THAT VEGETABLE
void DisplayInfo()
{
cout<<"\n VEGETABLE NAME IS :- "<
cout<<"\n VEGETABLE COLOR IS :- "<
cout<<"\n VEGETABLE TYPE IS :- "<
cout<<"\n VEGETABLE NUTRIENTS ARE GIVEN BELOW :- ";
cout<<"\n PROTEIN :- "<
cout<<"\n CARBOHYDRATES :- "<
cout<<"\n FATS :- "<
cout<<"\n FIBRES:- "<
}
};
//GARDEN CLASS
class Garden{
public :
string name; // NAME OF GARDEN
Vegetable veg[20]; //Array of vegetable class
int price[20],total_veg=0;
Garden ()
{
price[0]=-1;
total_veg=0;
}
void DisplayVegetables()
{
if (total_veg==0)
{
cout<<"\n SORRY THERE ARE NO VEGETABLES RIGHT NOW";
}
else
{
cout<<"\n LIST OF VEGETABLES PRESENT IN "<
cout<<"\n GIVEN BELOW";
for (int i=0;i
{
cout<<"\n Name of the vegetable :- "<
cout<<"\n Price in garden"<
}
}
}
};
struct Element//Structure
{
string veg_name; //NAME OF VEGETABLE
string veg_color; //COLOR OF VEGETABLE
string veg_type; //TYPE OF VEGETABLE
int veg_protein_qty,veg_carbs_qty,veg_fats_qty,veg_fibre_qty; //NUTRIENTS VALUE
int veg_price;
//COUNT THE NUMBER OF PLANTS
void Count_Number_Plants(Garden *g)
{
int total=0;
for (int i =0;i<20;i++)
{
if (g->price[i]==-1)
{
break;
}
else{
total++;
}
}
cout<<"\n The total count of PLANTS IS "<
}
//UPDATE VEGETABLE DETAILS
void Update_Vegetable_Details(Garden *g,string name)
{
if (g->total_veg==0)
{
cout<<"\n NO SUCH VEGETABLE IN THE GARDEN";
}
else{
transform(name.begin(), name.end(), name.begin(), ::toupper);
int x;
for (int i=0; i
total_veg;i++)
{
transform(g->veg[i].name.begin(), g->veg[i].name.end(), g->veg[i].name.begin(), ::toupper);
x= name.compare(g->veg[i].name);
if(x==0)
{
cout<<"\n ENTER THE NAME OF VEGETABLE \t";
cin>>veg_name ;
cout<<"\n ENTER THE COLOR OF VEGETABLE \t";
cin>>veg_color ;
cout<<"\n ENTER THE TYPE OF VEGETABLE \t";
cin>>veg_type ;
cout<<"\n ENTER THE NUTRIENTS OF VEGETABLE \t";
cout<<"\n ENTER PROTEINS \t";
cin>>veg_protein_qty;
cout<<"\n ENTER CARBPHYDRATES \t";
cin>>veg_carbs_qty;
cout<<"\n ENTER FATS \t";
cin>>veg_fats_qty;
cout<<"\n ENTER FIBRE \t";
cin>>veg_fibre_qty;
cout<<"\n ENTER THE PRICE OF VEGETABLE \t";
...