Академический Документы
Профессиональный Документы
Культура Документы
#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";
cin>>instrument_nm;
cout<<"\n\n"<<"\t";
cin>>brand;
cout<<"\n\n"<<"\t";
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
void modify()
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 ";
getch();
class customer
char cno[6];
char cname[50];
int paid;
char iname[50];
public:
void create_cust()
{
cout<<"\nNEW CUSTOMER ENTRY....\n";
cin>>cno;
gets(cname);
gets(iname);
cin>>paid;
void report()
cout<<cno<<setw(42)<<cname<<setw(30)<<iname<<setw(23)<<paid<<endl;
};
//___________________________________________________________________________
____________
fstream fp;
customer cu;
//***************************************************************
//****************************************************************
void write_cust()
char ch;
fp.open("cust.dat",ios::out|ios::app);
do
clrscr();
cu.create_cust();
fp.write((char*)&cu,sizeof(customer));
cin>>ch;
} while(ch=='y'||ch=='Y');
fp.close();
//___________________________________________________________________
void display_c()
clrscr();
fp.open("cust.dat",ios::in);
if(!fp)
getch();
return;
cout<<"\n\n\t\t\tC U S T O M E R L I S T \n\n";
cout<<"======================================================================
==========\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";
cin>>choice;
clrscr();
switch(choice)
//___________________________________________________________________________
________________________________________________
case 1: fp.clear();
do{
s.input();
fp.write((char*)&s,sizeof(s)) ;
cout<<"\n\n"<<"\t";
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";
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";
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
XII-B