Вы находитесь на странице: 1из 20

PROJECT BEGINS HERE

#include<iostream.h>

#include<conio.h>

#include<stdio.h>

#include<dos.h >

#include<string.h>

#include<fstream.h>

#include<process.h>

#include<iomanip.h>

class shop

private:

char instrument_nm[20];

char brand[20];

int model_no;

float price;

public:
//************************************************ function to input
record***********************************************

void input()

cout<<"\n\n\n";

cout<<" I N S T R U M E N T N A M E ---- ";

cin>>instrument_nm;

cout<<"\n\n"<<"\t";

cout<<" B R A N D ---- ";

cin>>brand;

cout<<"\n\n"<<"\t";

cout<<" M O D E L N U M B E R ---- ";

cin>>model_no;

cout<<"\n\n"<<"\t";

cout<<" P R I C E ----";

cin>>price;

cout<<"\n\n"<<"\t";

}
//*******************************************function to display all the
record*******************************************

void output()

cout<<instrument_nm<<"\t";

cout<<brand<<"\t";

cout<<model_no<<"\t";

cout<<price<<endl;

void reporti()

cout<<instrument_nm<<setw(42)<<brand<<setw(30)<<model_no<<setw(23)<<price<<en
dl;

//*******************************************function to search a
record**************************************************

int search(int t)

if(t==model_no)

output();
return 1;

return 0;

~shop() // DESTRUCTOR

//***************************************member function to modify the


records********************************************

void modify()

cout<<" N E W P R I C E ---- ";

cin>>price;

} ;

//***************************************************************

// INTRODUCTION FUNCTION

//****************************************************************

void intro()

clrscr();
gotoxy(25,11);

cout<<"M U S I C S H O P ";

gotoxy(25,12);

cout<<"M A N A G E M E N T ";

gotoxy(25,13);

cout<<"S Y S T E M ";

cout<<"\n\n\n\nMADE BY : LANCY SIMON and NIKHIL SAHU ";

cout<<"\n\nSCHOOL : DAV PUBLIC SCHOOL ";

getch();

class customer

char cno[6];

char cname[50];

int paid;

char iname[50];

public:

//---------------------------------NEW CUST RECORD---------------------------


------

void create_cust()

{
cout<<"\nNEW CUSTOMER ENTRY....\n";

cout<<"\nENTER MODEL NUMBER CUSTOMER IS BUYING....";

cin>>cno;

cout<<"\n\nENTER NAME OF CUSTOMER.... ";

gets(cname);

cout<<"\n\nENTER THE NAME OF INSTRUMENT ";

gets(iname);

cout<<"CUSTOMER PAID RUPEES.... "<<"\n";

cin>>paid;

cout<<"\n\n\nCUSTOMER CREATED SUCCESSFULLY...."; }

void report()

cout<<cno<<setw(42)<<cname<<setw(30)<<iname<<setw(23)<<paid<<endl;

};

//class ends here

//___________________________________________________________________________
____________
fstream fp;

customer cu;

//***************************************************************

// function to write in file

//****************************************************************

void write_cust()

char ch;

fp.open("cust.dat",ios::out|ios::app);

do

clrscr();

cu.create_cust();

fp.write((char*)&cu,sizeof(customer));

cout<<"\n\nDo you want to add more record..(y/n?)";

cin>>ch;

} while(ch=='y'||ch=='Y');

fp.close();

//___________________________________________________________________
void display_c()

clrscr();

fp.open("cust.dat",ios::in);

if(!fp)

cout<<"ERROR!!! FILE COULD NOT BE OPEN ";

getch();

return;

cout<<"\n\n\t\t\tC U S T O M E R L I S T \n\n";

cout<<"======================================================================
==========\n";

cout<<"MODEl NUMBER"<<setw(20)<<"CUSTOMER NAME"<<setw(20)<<"INSTRUMENT


NAME"<<setw(20)<<"PRICE PAID\n";

cout<<"======================================================================
==========\n";

while(fp.read((char*)&cu,sizeof(cu)))

cu.report();

fp.close();

getch();
}

void main()

clrscr();

intro();

shop s;

int t_id,f,choice;

char ans;

int a;

clrscr();

fstream fp,tfp;

fp.open("shop.dat",ios::in|ios::out|ios::ate|ios::binary);

clrscr();

do{

clrscr();

cout<<"\n\n\n";

cout<<"\t"<< " [1] A D D I N S T R U M E N T\n\n";

cout<<"\t"<< " [2] D I S P L A Y A L L I N S T R U M E N


T\n\n";

cout<<"\t"<< " [3] M O D I F Y I N S T R U M E N T P R I C


E\n\n";

cout<<"\t"<< " [4] D E L E T E I N S T R U M E N T\n\n";

cout<<"\t"<< " [5] A D D C U S T O M E R 'S D A T A\n\n";

cout<<"\t"<< " [6] D I S P L A Y C U S T O M E R S P U R C H


A S E\n\n\n";
cout<<"\t"<< " [0]_____E X I T______ \n\n\n";

cout<<"\t"<< " Y O U R C H O I C E ----- ";

cin>>choice;

clrscr();

switch(choice)

//___________________________________________________________________________
________________________________________________

case 1: fp.clear();

do{

s.input();

fp.write((char*)&s,sizeof(s)) ;

cout<<"\n\n"<<"\t";

cout<<"ANY MORE......PRESS Y\n\t else PRESS ANY KEY...";

cin>>ans;

clrscr();

while(ans=='y'||ans=='Y');

break;

//___________________________________________________________________________
_________________________________________________

case 2: fp.clear();

fp.seekg(0);
{

cout<<"\n\n\t\t\t****I N S TR U M E N T L I S T****\n\n";

cout<<"======================================================================
==========\n";

cout<<"INSTRUMENT NAME"<<setw(30)<<"BRAND"<<setw(30)<<"MODEL
NUMBER"<<setw(30)<<"PRICE"<<endl;

cout<<"======================================================================
==========\n";

while(fp.read((char*)&s,sizeof(s)))

{ s.reporti();

break;

//___________________________________________________________________________
_________________________________________________

case 3: fp.clear();

fp.seekg(0);

tfp.open("temp.dat",ios::out|ios::binary);
cout<<"\n\n"<<"\t";

cout<<"TO MODIFY INSTRUMENTS PRICE PLEASE ENTER MODEL


NUMBER ";

cin>>t_id;

while(fp.read((char*)&s,sizeof(s)))

f=s.search(t_id);

if(f==1)

s.modify() ;

tfp.write((char*)&s,sizeof(s));

fp.close();

tfp.close();

remove("shop.dat");

rename("temp.dat","shop.dat");

fp.open("shop.dat",ios::in|ios::out|ios::ate|ios::binary);

break;

//___________________________________________________________________________
____________________________________________________

case 4: fp.clear();

fp.seekg(0);

tfp.open("temp.dat",ios::out|ios::binary);

cout<<"\n\n"<<"\t";

cout<<"TO DELETE YOUR INSTRUMENT PLEASE ENTER MODEL NUMBER


";
cin>>t_id;

while(fp.read((char*)&s,sizeof(s)))

f=s.search(t_id);

if(f==0)

tfp.write((char*)&s,sizeof(s));

fp.close();

tfp.close();

remove("shop.dat");

rename("temp.dat","shop.dat");

fp.open("shop.dat",ios::in|ios::out|ios::ate|ios::binary);

break;

//___________________________________________________________________________
____________________________________________________

case 5: clrscr();

write_cust();

break;

//___________________________________________________________________________
____________________________________________________

case 6: fp.clear();

display_c();
break;

getch();

} while(choice!=0);

//********************************************************END OF THE
PROGRAM******************************************************
CERTIFICATE

This is to certify-______________________
Roll _______ of class _______ of DAV Public
SCHOOL Vasant Vihar SECL Bilaspur has
successfully conducted all the assignments and
Projects under my supervision.
I have recommended the work as a part of fulfiment
of Computer science Practical of class _____ during
session 2019-20

Principal Sir

MR AJAY EXTERNAL

(CS Dept)
ACKNOWLEDGEMENT
I would like to express deep sense of gratitude to
my project guide Mr. Ajay Innes for guiding me

Through the course of project completed by me


as CBSE curriculum of AISSE- 2019-20. He has
always evinced keen interest on my work; His
constant motivation has been responsible for the
successful completion of my project.

My sincere thanks goes to Mr. A. K. Khanna, our


Principal, on his co-ordination in extending every
possible support for completion of the project.

Project undertaken by:-

XII-B

Вам также может понравиться