Book shop mini project using c++

Book shop 

#include<fstream.h>
#include<conio.h>              //for clscr() function
#include<ctype.h>              //for toupper() function
#include<string.h>             //for strcpy) and strmpi() function
#include<math.h>               //for pow() function
#include<stdio.h>              //for gets() function

//creating function prototype
void staff();
void customer();
void bill();
void create();
void display();
void append();
void modify();
void total();

//creating class item
class item
{
 public:
 int icode;
 char iname[80];
 int iprice;

 //creating function input() to take the details from the user
 void input()
 {
  cout<<"Enter the code of the item: "<<endl;
  cin>>icode;
  cout<<"Enter the name of the item: "<<endl;
  gets(iname);
  cout<<"Enter the price of the item: "<<endl;
  cin>>iprice;
 }

 //creating function output() to display the details as entered by the user
 void output()
 {
  cout<<"The item code is: "<<icode<<endl;
  cout<<"The item name is: "<<iname<<endl;
  cout<<"The item price is: "<<iprice<<endl<<endl;
 }

 //creating function retname() to return name
 char*retname()
 {
  return iname;
 }

 //creating function retcode() to return code
 int retcode()
 {
  return icode;
 }

 //creating function retprice() to return iprice
 int retprice()
 {
  return iprice;
 }
}; //end of class item

//creating class product
class product
{
 public:
 float price;
 int code;
 char name[80];
 int qty;
 long tot;

 //creating function getdata() to get details of the items to be purchased
 void getdata()
{
 cout<<"Enter the item code to be purchased: "<<endl;
 cin>>code;
 cout<<"Enter the quantity of item to be purchased: "<<endl;
 cin>>qty;
 cout<<endl;
}

//creating function total() to calculate the total
void total()
{
 tot=((qty)*(price));
}

//creating function retotal() to retotal
float retotal()
{
 return tot;
}

//creating function showdata() to display the details of the item purchased
 void showdata()
{
 cout<<"The code of the purchased item is: "<<code<<endl;
 cout<<"The name of the purchased item is: "<<name<<endl;
 cout<<"The quantity iof the purchased item is: "<<qty<<endl;
 cout<<"The price of the purchased item is: "<<price<<endl;
}
}; //end of class product

//function for entering into the program
 void intro()
{
 clrscr();
 int ch;
 do
 {
  cout<<"................         book shop            ..............."<<endl;
  cout<<"………..                                    …………."<<endl;
  cout<<"_________________________________________________________"<<endl;
  cout<<"_________________________________________________________"<<endl;
  cout<<endl<<endl;
  cout<<"YOU WANT TO ENTER AS "<<endl;
  cout<<"1. STAFF"<<endl;
  cout<<"2. CUSTOMER"<<endl;
  cout<<"3. EXIT"<<endl;
  cout<<"Enter your choice"<<endl;
  cin>>ch;
  switch(ch)
  {
            case 1:staff();
                                     break;
            case 2:customer();
                                     break;
            case 3:break;
  }
 } while(ch!=3);
}

//creating function staff() for staff use only
 void staff()
{
 clrscr();
 int ch;
 do
 {
  cout<<"WHICH OPERATION DO YOU WANT TO PERFORM ?"                  <<endl<<endl;
  cout<<" 1.     Create the menu"                                                                                <<endl;
  cout<<" 2.     Display the menu"                                                                               <<endl;
  cout<<" 3.     Add new record in the menu"                                                <<endl;
  cout<<" 4.     Modify a record"                                                                                <<endl;
  cout<<" 5.     Go to the menu"                                                                                              <<endl;
  cout<<"Enter your choice"                                                                                                   <<endl;
  cin>>ch;
  switch(ch)
  {
            case 1:create();
                                     break;
            case 2:display();
                                     break;
            case 3:append();
                                     break;
            case 4:modify();
                                     break;
            case 5:break;
  }
 } while(ch!=5);
}

//creating function create() to write the records
void create()
{
 clrscr();
 fstream fil;
 char ch;
 item s;
 fil.open("ITEM.DAT",ios::out|ios::binary);
 do
 {
  s.input();
  fil.write((char*)&s,sizeof (s));
  cout<<"Do you want to enter more records?(y/n)"<<endl;
  cin>>ch;
  cout<<endl;
 }
 while(ch=='y'||ch=='Y');
 fil.close();
}

//creating function display() to display the records
void display()
{
 clrscr();
 item s;
 fstream fil;
 fil.open("ITEM.DAT",ios::in|ios::binary);
 while(fil.read((char*)&s,sizeof s))
 {
 s.output();
 }
 fil.close();
}

//creating function append() to append record
void append()
{
 clrscr();
 item s;
 char ch;
 fstream fil;
 fil.open("ITEM.DAT",ios::app|ios::binary);
 do
 {
 s.input();
 fil.write((char*)&s,sizeof s);
 cout<<"Do you want to append more records?"<<endl;
 cin>>ch;
 }while(ch=='y'||ch=='Y');
 fil.close();
}

 //creating function modify() to modify a record
 void modify()
{
 clrscr();
 int code;
 item s;
 fstream fil;
 cout<<"Enter the code of the item to be modified:"<<endl;
 cin>>code;
 fil.open("ITEM.DAT",ios::in|ios::out|ios::binary);
 while(fil.read((char*)&s,sizeof s))
 {
  if (s.retcode()==code)
  {
            fil.seekp(fil.tellg()-sizeof(s),ios::beg);
            s.input();
            fil.write((char*)&s,sizeof(s));
  }
 }
 fil.close();
 }


  //creating function customer()
  void customer()
  {
            clrscr();
            long gtot=0;
            display();
            char ch;
            product s;
            fstream fil,ifil;
            item a;
            fil.open("cust.dat",ios::out|ios::binary);
            do
            {
             s.getdata();
             ifil.open("ITEM.DAT",ios::in|ios::binary);
             while(ifil.read((char*)&a,sizeof (a)))
             {
              if(a.retcode()==s.code)
              {
                        s.price=a.retprice();
                        strcpy(s.name,a.retname());
                        s.total();
                        fil.write((char*)&s,sizeof (s));
              }
             }
             gtot+=(s.retotal());
             cout<<"Do you want to continue purchasing?(y/n)"<<endl;
             cin>>ch;
             ifil.close();
            }while(ch=='y'||ch=='Y');
            fil.close();
            fil.open("cust.dat",ios::in|ios::binary);
            cout<<endl;
            cout<<"$$$$$$$$$$$$$$$$          BILL       $$$$$$$$$$$$$$$$$"<<endl;
            cout<<endl;
            cout<<"your bill goes as............"<<endl;
            while(fil.read((char*)&s,sizeof (s)))
            {
             s.showdata();
             cout<<endl;
            }
            cout<<endl;
            cout<<"GRAND TOTAL                                          Rs."<<gtot<<endl;
            cout<<endl;
            cout<<"===============THANKS FOR VISITING==============="<<endl;
            }

  //creating function main()
            void main()
  {
            intro();
  }


Report :

OBJECTIVE:

Aim of this project is to make purchasing of books online. In traditional purchasing of books it is difficult to keep record of available books for selling books to a customer. So the purpose of this purchasing of books is to make the work of buyer, seller and company books easier by keeping record of available books of different subjects & authors and provide details of the books to customers in a quick manner. This website also provides facility to the user for maintaining and managing stock of books. Customer can buy books of their choice and by card. This website also allow user to write feedback about the various books so that other user knows about the feedback of the book. The company can view the dispatch details of various order booked by various users.


REQUIREMENTS:
1) HARDWARE REQUIREMENT:
       a)  Ram: 512 MB or greater
  b)  CPU: 2 GHZ or greater
       c)  Hard-disk Space: 40 GB or greater

2)  SOFTWARE REQUIREMENT:
  TECHNOLOGY
   c++
   DATABASE
   SQL Server 2005

BRIEF DESCRIPTION:

This project automates the traditional purchasing of books. Since in traditional purchasing of books, it is difficult to keep record of available books for sale and purchase with the customer, this project makes purchasing of books online by reserving books for customer online which automatically keeps track of available books for each book.
There are basically two types of users that can be created-

1.      Aministrator – This user has access to add a new book, view/ update/delete an existing book, book a book for a customer and view an existing customer order status. This user can also add book detail, update/delete book and also handle order of a customer online.

2.      User( Customer) – This user has limited access to the system. This type of user mainly includes users who can perform all operations except the Admin specific operations. User’s most commonly performed action is to book a book and also sell his old book set at a best price online. Along with this, user can view/update customer details.

When ever any user logs into the system, system identifies the role of the user. Based on the role home page is displayed to the user which contains all the links for the actions that the user has access to.
Hence, this application speeds up the working of purchasing of books by its efficient way of reserving books and keeping track of various necessary book records online.








Post a Comment

8 Comments

  1. Nice program .. good effort .. keep it up.. :)

    ReplyDelete
    Replies

    1. Thanks for the post, I am techno savvy. I believe you hit the nail right on the head. I am highly impressed with your blog. It is very nicely explained. Your article adds best knowledge to our Java Online Training from India. or learn thru Java Online Training from India Students.

      Delete
  2. Hi,
    I have some PHP-MYSQL, C++, VB, ASP.NET & JAVA projects which i want to sell @ low price.

    ReplyDelete
  3. Email me at anjanibagdaik@gmail.com

    ReplyDelete
  4. ur program had 7 errors.How can I correct those errors?
    for example:- "unable to include all the header files.

    ReplyDelete
  5. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    Best Devops Training in pune
    Best Devops Training institute in Chennai

    ReplyDelete