Sie sind auf Seite 1von 8

In this project that is GROCERY MANAGEMENT SYSTEM prepared, is designed to

manage a shop. It contains the details about the materials available in the grocery, as

well as the pricing details etc.

And all the details related to them are computerized and can be further used at any time

of requirements. This program is capable of holding any number of billing details. And

all the operations are done in five options.

First window will show the details of shop management.

In the second window there are five options. We can select any option as we wish.

In the first option, it is the display option. It will show the items present in the shop as

well as its price rate.

In the second option, it will ask the user to enter the number of items the user wants

to insert in the database.

In the third option, it will show the user options to choose what he wants to update.

In the fourth option, it will display the delete functionality, which item will be deleted.

The fifth option is the search window. It will show every detail of that particular item.

Program Code:

#include <string>

#include <iostream>

using namespace std;

class ITEM

public:

char name[30];
int code;

int price;

int qty;

int n;

ITEM() //constructor-immediately when the program runs, it will be initiated.

//this arguments will help avoid gabage in the memory of the array

// name=NULL;

price= NULL;

qty= NULL;

void insert()

cout<<"enter item name"<<endl;

cin>>name;

cout<<"enter code ";

cin>>code;

cout<<"enter price ";

cin>>price;

cout<<"enter quantity ";

cin>>qty;

void display() //display function

cout<<endl;
cout<<"Item code"<<'\t';

cout<<"Item name"<<'\t';

cout<<"Item price"<<'\t';

cout<<"Item quantity"<<'\t'<<endl<<endl;

cout<<code<<'\t'<<'\t';

cout<<name<<'\t'<<'\t';

cout<<price<<'\t'<<'\t';

cout<<qty<<endl;

void del() //delete function

if (code==n) //if the variable entered is similar with the code price and qty will be

deleted(NULL)

price= NULL;

qty= NULL;

void update() //the update function will allow user to change data input in the

system

int choose;

cout<<"1.name 2.price 3.quantity"<<endl;

cin>>choose;
switch(choose) //using the switch case will make it more flexible for the user

to choose what to change in an item

case 1:

{ cout<<"change name: ";

cin>>name;

}break;

case 2:

{ cout<<"change price: ";

cin>>price;

}break;

case 3:

{ cout<<"change quantity: ";

cin>>qty;

}break;

default: cout<<"Invalid option"<<endl;

void search()

if (price!=NULL)

display();

}
}

~ITEM()

// cout<<" you've exited the system. Have a nice day!"<<endl;

};

int main()

char name[30];

int code;

int price;

int qty;

cout<<"1.Insert 2.Update 3.Delete 4.Search 5.Exit"<<endl; //options menu

ITEM t[100];

int options;

int n;

int i;

cin>>options;

switch(options)

case 2: //update option

cout<<"enter item code"<<endl;


cin>>n;

for ( i=0; i<100; i++)

if (code==n)

t[i].update;

return (options);

}break;

case 1: //insert options

cout<<"enter number of items you want to insert"<<endl;

cin>>n;

for (i=0; i<n; i++)

t[i].insert();

return(options);

}break;

case 3: //delete option

cout<<"enter item code"<<endl;


cin>>n;

for (int j=0; j<100; j++)

t[i].del();

return(options);

}break;

case 4: { //search option

cout<<"enter item code"<<endl;

cin>>n;

for(i=0; i<100; i++)

t[i].search();

for (i=0; i<100; i++)

if (price!=NULL)

t[i].display();

}
return 0;

Das könnte Ihnen auch gefallen