SlideShare uma empresa Scribd logo
1 de 49
COMPUTERPROJECTONTHETOPIC
VIDEO LIBRARY MANAGEMENT SYSTEM
USING C++
For thefulfillmentofthe
Terms andconditionssetsbythec.b.s.e.
For thecomputer sciencepracticalpaper
Of theallIndiasenior secondaryschool
Examination– 2015-16
Submitted By : Project Supervisor :
Name :Parv Poddar Mr. Amarnath Yadav
Class : XII ”daffodil “ Teacher Of Computer
Roll: 6604252 Science
D.A.V PublicSchool, D.A.V Public School, Jharsuguda.
Jharsuguda.
For the fulfillment of
the terms and conditions sets
by the C.B.S.E. for the
Computer Science Practical
paper of the All India Senior Secondary School
Examination - 2015-16
Submitted by : Project Supervisor :
Name : PARV PODDAR MR. Amarnath Yadav
Class : XII “Daffodil” Teacher of Computer Science
Roll : D.A.V Public School
D.A.V Public School Jharsuguda.
Jharsuguda.
ACKNOWLEDGEMENT
This project work has been successful due to the pains
taken by many people. It is not possible for me to
acknowledge all of them individually. I take this opportunity to
express my gratitude to them. However to my Computer
Teacher Mr. Amarnath Yadav, I am specially indebted. I am
also be held by associates who helped me a lot in this project.
I once again thank my Computer teacher for going through the
project thoroughly and pointing me about some errors in this
project.
Finally I thank the members of my family for their support
and encouragement.
--
Bonafide Certificate
This is to certify that the project entitled “Video Library
Management System” submitted by of
Class XII is in accordance to him. This project is submitted for
the fulfillment of conditions laid down for “AISSE 2015-16”. It
embodies the work done by us under the supervision and
guidance of Mr. Amarnath Yadav (Teacher of Computer
Science, D.A.V Public School, Jharsuguda).
Signature of the Student Signature of the Teacher
Signature of the Principal
DECLARATION
I, PARV PODDAR, a student of Class – XII of D.A.V
Public School, Jharsuguda, do hereby solemnly declare
that this project entitled
“Video Library Management System “
submitted for the Computer Practical Paper for the AISSE -
2015-16 consists of the original work done by me under the
guidance and supervision of our computer teacher Mr.
Amarnath Yadav.
Place : Jharsuguda
Date : Class : XII
Roll. No :
D.A.V. Public School
Jharsuguda
Video Library Management System
//VideoLibraryManagementSystem
// Declarationof headerfiles
#include <iostream.h>
#include <fstream.h>
#include <process.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <conio.h>
#include <dos.h>
#include <stdlib.h>
#include <iomanip.h>
#include <graphics.h>
typedef charoption[15];
const intROW = 10, COL = 10;
intscan; // To holdthe special charactersformovingthe promptin menu
intascii;
// To displaythe mainmenuoptions
optiona[]={
"NewCassPur",
"ListOfPurchase",
"DailyCassSales",
"SalesReport",
"AddOtherExp",
"OtherExpRep",
"ClosingStock",
"MonthlyProfit",
"Exit"
};
// Functionusedtodo screening
classmain_menu
{
inti,done;
public:
voidnormalvideo(intx,inty,char*str);
voidreversevideo(intx,inty,char*str);
voidbox(intx1,inty1,intx2,inty2);
char menu();
voidcontrol_menu();
voidhelp(void);
};
/* Classmemberfunctionsfordrawingboxes*/
classshape
{
public:
voidline_hor(int,int,int,char);
voidline_ver(int,int,int,char);
voidbox(int,int,int,int,char);
};
// Classcontainsthe cassettes/CDsdeposit of customers
classcassettes
{
public:
voidnew_cassettes(void); // Functiontoadd new cassettes/CDsinmusicshop
// For cassettes/CDsentryintothe cassettes.datdatafile
voidadd_to_file(int,chart_Cass_name[30],char t_Comp_name[30],int,int,int,int,float);
voiddisplay_list(void);//Displayingthe cassettes/CDslist
voiddelete_cassette(int);//Deletesthe temporarycassetterecord
intlast_cas_code(void);//if the file isexistornot
char *return_name(int);//Functionfor validationentryof name
char *return_address(int);//Functionforvalidationentryof address
intrecordno(int);
voiddisplay(int);//Todisplaythe cassette/CDinformationaccount
private:
// Data Membersof cassette.datdatafile
intcas_code; // cassette/CDcode - film, nonfilm, religious
char Cass_name[30]; // Title of the cassette/CD
char Comp_name[30]; // cassette/CDcompany
inttot_cassette; // Total cassette/CDpurchased
intdd, mm, yy; // Date of purchase
floatprice; // Price percassette/CD
};
classbalance
{
public:
voidadd_to_file(int,int,int,int,int,float); // Addrecordfor balance cassette/CD
voidbalance_cassette(void); // Functiontodisplaythe balance cassette/CD
voiddelete_balance(int); // Deletingthe balance fromTbal.dat
intgive_balance(int); // returnsthe currentbalance of a particular
// cassette/CDcode
voidUpdate_balance(int,int,int,int,int,float);//Functionto update balance after
cassette/CDsale
floatreturn_price(int); // Returnthe cassette/CDprice
voidmonthly_profit(void); // Monthlyprofitaftereverytransaction
private:
// Data membersof Tbal.datdatafile
intcas_code; // cassette/CDcode tobe balance
intcas_bal; // Total numberof cassettes/CDsinbalance
intdd; // Balance date
intmm;
intyy;
floatprice; // Unitprice of cassettes/CDsoncode wise
};
// Classcontainsthe customersdailycassette/CDtransactionentry
classaccount
{
public:
voidnew_account(void); // Functiontosale cassettes/CDs
voidclose_account(void); // Functiontoclose the cassette/CDpurchase
voidclear(int,int);//Functiontoperformaclearscreenfunction
voidDisplay_sales(void); // Displayingthe salesreportof cassettes/CDs
intlast_cas_code(void);//if the file isexistornot
floatsales_status(intm1,inty1, floatcod1, floatcod2,floatcod3);
private:
voidadd_to_file(int,chartP_name[30],char tP_address[30],int,int,int,int);//Functionto
add transactionrecords
voiddelete_account(int);//Functiontodelete atransactionrecord
// Data membersof person.datdatafile
intcas_code; // cassette/CDcode - film, nonfilm, religious
char P_name[30]; // PersonName
char P_address[30]; // PersonAddress
intNo_cass; // Numberof cassette/CD
intdd, mm, yy; // To store the systemdate/purchase date
};
classother
{
public:
// Functiontodisplayotherexpense screenlikesalary,
// electricitybill,telephone andmiscellaneousexpences
voidExpense_other(void);
// Addthe data to Other.datdata file
voidadd_to_file(int,chartNat_Expen[30],int,int,int,float);
voiddisplay_expense(void); // Displaythe expenses
floatother_status(intm1,inty1);
private :
// Data membersof other.datdatafile
intO_code; // Otherexpence code
/* The otherexpence code as:
1 - Salaryto workers,
2 - Electricitybill
3 - Telephone bills
4 - Miscellaneousexpenses*/
char Nat_Expen[30]; // Nature of expense description
intdd, mm, yy; // Expense date
floatamount; // Expense amount
};
// Functiontodisplaysall the menupromptmessages
// fromthe pointerarray of optiona[]
voidmain_menu::normalvideo(intx,inty,char*str)
{
gotoxy(x,y);
cprintf("%s",str);
}
// Functiontomove the cursor on the menuprompt
// witha reverse videocolor
voidmain_menu::reversevideo(intx,inty,char*str)
{
textcolor(5+143);
textbackground(WHITE);
gotoxy(x,y);
cprintf("%s",str);
textcolor(GREEN);
textbackground(BLACK);
}
voidmain_menu::box(intx1,inty1,intx2,inty2)
{
for(intcol=x1;col<x2;col++)
{
gotoxy(col,y1);
cprintf("%c",196);
gotoxy(col,y2);
cprintf("%c",196);
}
for(introw=y1;row<y2;row++)
{
gotoxy(x1,row);
cprintf("%c",179);
gotoxy(x2,row);
cprintf("%c",179);
}
gotoxy(x1,y1);
cprintf("%c",218);
gotoxy(x1,y2);
cprintf("%c",192);
gotoxy(x2,y1);
cprintf("%c",191);
gotoxy(x2,y2);
cprintf("%c",217);
}
// Displayingthe mainmenuof musicsystem
char main_menu::menu()
{
clrscr();
textcolor(22);
box(20,6, 65, 20);
box(18,4, 67, 22);
textcolor(5+143);
gotoxy(36,5);
textbackground(BLUE);
cprintf("MU S I C");
textbackground(BLACK);
textcolor(22);
for(i = 1; i < 9; i++)
normalvideo(32,i+10,a[i]);
reversevideo(32,10,a[0]);
i = done = 0;
_setcursortype(_NOCURSOR);
do
{
intkey= getch();
switch(key)
{
case 00:
key= getch();
switch(key)
{
case 72:
normalvideo(32,i+10,a[i]);
i--;
if (i == -1)
i = 8;
reversevideo(32,i+10,a[i]);
break;
case 80:
normalvideo(32,i+10,a[i]);
i++;
if (i == 9)
i = 0;
reversevideo(32,i+10,a[i]);
break;
}
break;
case 13:
done = 1;
}
} while (!done);
_setcursortype(_NOCURSOR);
return(i+49);
}
/* The functionmain_menu() isusedtodisplaythe mainmenusystem*/
voidmain_menu::control_menu()
{
char choice;
cassettescas;
account a;
balance bal;
otheroth;
do
{
choice = menu();
clrscr();
switch(choice)
{
case '1':
_setcursortype(_NORMALCURSOR);
box(3,1, 75, 24);
box(5,2, 73, 23);
cas.new_cassettes();//New cassette/CDentryfunction
break;
case '2':
box(3, 1, 75, 24);
box(5,2, 73, 23);
cassettesini;
ini.display_list();//Glogal listof cassettes/CDsfunction
break;
case '3':
box(3,1, 75, 24);
box(5,2, 73, 23);
_setcursortype(_NORMALCURSOR);
a.new_account();//Enterthe personwisesale cassette/CD
break;
case '4':
box(3,1, 75, 24);
box(5,2, 73, 23);
account a;
_setcursortype(_NORMALCURSOR);
a.Display_sales();//Displaysthe salescassettes/CDs
break;
case '5':
box(3,1, 75, 24);
box(5,2, 73, 23);
_setcursortype(_NORMALCURSOR);
oth.Expense_other();//Entryof otherexpenses
break;
case '6':
box(3,1, 75, 24);
box(5,2, 73, 23);
gotoxy(10,10);
oth.display_expense(); // Displaysthe expenses
break;
case '7':
box(3,1, 75, 24);
box(5,2, 73, 23);
gotoxy(10,10);
bal.balance_cassette();//Functiontodisplaythe balance cassettes/CDsin
shop
break;
case '8' :
box(3,1, 75, 24);
box(5,2, 73, 23);
gotoxy(10,10);
// Monthlyprofitaftereverytransaction
bal.monthly_profit();
break;
case '9' :exit(0);
}
} while (choice!=8);
}
/* Functionto drawhorizontal line formenu*/
voidshape::line_hor(intcolumn1,intcolumn2,introw,char c)
{
for (column1;column1<= column2; column1++)
{
gotoxy(column1,row);
cout << c;
}
}
/* Functionto drawvertical line formenu*/
voidshape::line_ver(introw1,introw2,intcolumn,char c)
{
for (row1;row1 <= row2; row1++)
{
gotoxy(column,row1);
cout << c;
}
}
/* Functionfordrawingboxesformenu*/
voidshape::box(intcolumn1,introw1,intcolumn2,introw2, char c)
{
char ch = 218;
char c1, c2, c3, c4;
char l1 = 196, l2 = 179;
if (c == ch)
{
c1 = 218;
c2 = 191;
c3 = 217;
c4 = 217;
l1 = 196;
l2 = 179;
}
else
{
c1 = c;
c2 = c;
c3 = c;
c4 = c;
l1 = c;
c2 = c;
}
gotoxy(column1,row1);
cout << c1;
gotoxy(column2,row1);
cout << c2;
gotoxy(column1,row2);
cout << c3;
gotoxy(column2, row2);
cout << c4;
column1++;
column2--;
line_hor(column1,column2,row1,l1);//Horizontal line
line_hor(column1,column2,row2,l1);
column1--;
column2++;
row1++;
row2--;
line_ver(row1,row2,column1,l2);//Vertical line
line_ver(row1,row2, column2,l2);
}
/* Functionto displayhelpaboutthisproject*/
voidmain_menu::help(void)
{
clrscr();
setbkcolor(7);
settextstyle(7,HORIZ_DIR,5);
outtextxy(70,20,"WelcometoVideoShop");
settextstyle(2,HORIZ_DIR,5);
outtextxy(60,100,"Thisprojectyour can keeprecordof dailymusiccassettes/CDs");
delay(2);
outtextxy(60,130,"transaction.Thisprogramis capable of holdinganyno.of cassettes/CDs.");
delay(2);
outtextxy(60,160,"-Infirstoptionyoucan enternew cassette/CD information");
delay(2);
outtextxy(60,190,"-Insecondoptionyoucan see the listof all the cassettes/CDs");
delay(2);
outtextxy(60,220,"-Inthirdoptionyoucansalesthe cassettes/CDsaccordingtodemand");
delay(2);
outtextxy(60,250,"-Throughfourthoptiionyoucansee the salesstatus");
delay(2);
outtextxy(60,280,"In the fifthoptionenteryourdailyotherexpenses");
delay(2);
outtextxy(60,310,"-Infifthoptionyoucan take monthWise individual accountreport");
delay(2);
outtextxy(60,340,"-Insixthoptionyoucantake reportsof otherexpenses");
delay(2);
outtextxy(60,370,"Note-:Enteronlyvaliddatawhile youmaintainthispackage");
delay(2);
outtextxy(60,400,"-AndlastoptionisQuit(ExitFromMusic Window)");
delay(2);
settextstyle(7,HORIZ_DIR,4);
outtextxy(80,420,"Pressanykeytocontinue...");
getch();
}
/* Functionfordisplayingacassette/CDinformationwhenrequired*/
voidcassettes::display(intt_cas_code)
{
fstreamfile;
file.open("cassettes.dat", ios::in);
file.seekg(0,ios::beg);
// Displaysthe recordcontentsmatching
// witht_cas_code from cassettes.datdatafile
while (file.read((char*)this,sizeof(cassettes)))
{
if (t_cas_code == cas_code)
{
gotoxy(8,5);
cout << "Accountno." << cas_code;
gotoxy(10,8);
cout << "Name : ";
puts(Cass_name);
gotoxy(10,9);
cout << "ComanyName : ";
puts(Comp_name);
gotoxy(10,10);
cout << "Price : " << setw(15) // setwidth
<< setprecision(2) //set position of decimal point
<< setiosflags(ios::left) // setleftjustifiedoutput
<< setiosflags(ios::showpoint) //alwaysshow decimal point
<< setiosflags(ios::fixed) // setfixednotationfordisplay
<< price;
break;
}
}
file.close();
}
/* Functionto findistheirrecordsincassette.datfile ornot*/
intcassettes::last_cas_code(void)
{
fstreamfile;
file.open("cassettes.dat",ios::in);
file.seekg(0,ios::beg);
inttcount = 0;
intcount = 0;
// Foundsthe last account no.
while (file.read((char*)this,sizeof(cassettes)))
{
tcount = cas_code;
count = count + tcount;
}
file.close();
returncount;
}
/* Functionto findistheirrecordsinfile person.datornot*/
intaccount::last_cas_code(void)
{
fstreamfile;
file.open("Person.dat",ios::in);
file.seekg(0,ios::beg);
inttcount = 0;
intcount = 0;
// Foundsthe lastaccount no.
while (file.read((char*)this,sizeof(account)))
{
tcount = cas_code;
count = count + tcount;
}
file.close();
returncount;
}
/* Functionforreturningbalance cassette/CD.
Thisfunctionreturnsthe balance cassette/CDoncode wise
to knowthe current balance from"Tbal.dat"datafile.*/
intbalance::give_balance(intt_cas_code)
{
fstreamfile;
file.open("Tbal.dat",ios::in);
file.seekg(0,ios::beg);
intt_balance = 0;
// Givesthe lastbalance of an individualaccount
while (file.read((char*)this,sizeof(balance)))
{
if (file.eof())
break;
if (cas_code == t_cas_code)
{
t_balance = cas_bal;
break;
}
}
file.close();
returnt_balance;
}
// Functiontoreturnthe cassette/CDprice
floatbalance::return_price(intt_cas_code)
{
floatt_price = 0.0;
fstreamfile;
file.open("Tbal.dat",ios::in);
file.seekg(0,ios::beg);
// Givesthe lastbalance of an individualaccount
while (file.read((char*)this,sizeof(balance)))
{
if (file.eof())
break;
if (cas_code == t_cas_code)
{
t_price = price;
break;
}
}
file.close();
returnt_price;
}
/* This function add_to_file() isusedtocreate
new/freshrecordinthe datafile */
voidcassettes::add_to_file(intt_cas_code,chart_Cass_name[30],
char t_Comp_name[30],intt_cas, inttdd, inttmm,int tyy,floatt_price)
{
cas_code = t_cas_code;
strcpy(Cass_name, t_Cass_name);
strcpy(Comp_name,t_Comp_name);
tot_cassette = t_cas;
dd = tdd;
mm = tmm;
yy = tyy;
price = t_price;
fstreamfile;
// Appendsnewaccountrecordwiththe price intocassettes.datdatafile
file.open("cassettes.dat", ios::out|ios::app);
file.write((char*)this,sizeof(cassettes));
file.close();
}
/* This functionadd_to_file() isusedto
create new/freshrecordinthe datafile */
voidbalance::add_to_file(intt_cas_code,
intt_cas, int tdd,inttmm, inttyy,float t_price)
{
intbal = give_balance(t_cas_code);
if (bal > 0)
{
fstreamfile;
file.open("Tbal.dat",ios::in);
fstreamtemp;
temp.open("TEMP.dat",ios::out);
file.seekg(0,ios::beg);
// Usesa copymethodto delete the cassette/CD
// fromcassette.datdatafile
while (!file.eof())
{
file.read((char*)this,sizeof(balance));
if (file.eof())
break;
if (cas_code != t_cas_code)
temp.write((char*)this,sizeof(balance));
else
{
cas_code = t_cas_code;
cas_bal = t_cas + bal;
dd = tdd;
mm = tmm;
yy = tyy;
price = t_price;
temp.write((char*)this,sizeof(balance));
}
}
file.close();
temp.close();
file.open("Tbal.dat",ios::out);
temp.open("TEMP.dat",ios::in);
temp.seekg(0,ios::beg);
// Copythe TEMP.dat contentsintocassette.datdatafile
while (!temp.eof())
{
temp.read((char*)this,sizeof(balance));
if (temp.eof())
break;
file.write((char*)this,sizeof(balance));
}
file.close();
temp.close();
}
else
{
cas_code = t_cas_code;
cas_bal = t_cas;
dd = tdd;
mm = tmm;
yy = tyy;
price = t_price;
fstreamfile;
// Appendsnewaccountrecordwiththe
// price intocassettes.datdatafile
file.open("Tbal.dat",ios::out|ios::app);
file.write((char*)this,sizeof(balance));
file.close();
}
}
// Functionfordeletingaaccount fromcassettes.datfile
voidcassettes::delete_cassette(intt_cas_code)
{
fstreamfile;
file.open("cassettes.dat",ios::in);
fstreamtemp;
temp.open("TEMP.dat",ios::out);
file.seekg(0,ios::beg);
// Usesa copymethodto delete the account
// fromcassette.datdatafile
while (!file.eof())
{
file.read((char*)this,sizeof(cassettes));
if (file.eof())
break;
if (cas_code != t_cas_code)
temp.write((char*)this,sizeof(cassettes));
}
file.close();
temp.close();
file.open("cassettes.dat",ios::out);
temp.open("TEMP.dat",ios::in);
temp.seekg(0,ios::beg);
// Copythe TEMP.dat contentsintocassette.datdatafile
while (!temp.eof())
{
temp.read((char*)this,sizeof(cassettes));
if (temp.eof())
break;
if (cas_code != t_cas_code)
file.write((char*)this,sizeof(cassettes));
}
file.close();
temp.close();
}
// Functionfordeletingabalance fromTbal.dat file
voidbalance::delete_balance(intt_cas_code)
{
fstreamfile;
file.open("Tbal.dat",ios::in);
fstreamtemp;
temp.open("TEMP.dat",ios::out);
file.seekg(0,ios::beg);
// Usesa copymethodto delete the accountfromTbal.datdatafile
while (!file.eof())
{
file.read((char*)this,sizeof(balance));
if (file.eof())
break;
if (cas_code != t_cas_code)
temp.write((char*)this,sizeof(balance));
}
file.close();
temp.close();
file.open("Tbal.dat",ios::out);
temp.open("TEMP.dat", ios::in);
temp.seekg(0,ios::beg);
// Copythe TEMP.dat contentsintoTbal.datdata file
while (!temp.eof())
{
temp.read((char*)this,sizeof(balance));
if (temp.eof())
break;
if (cas_code != t_cas_code)
file.write((char*)this,sizeof(balance));
}
file.close();
temp.close();
}
/* Functionforadd an account detailsof
dailytranactionintoperson.datfile.*/
voidaccount::add_to_file(intt_cas_code,chartP_name[30],
char tP_address[30],inttNo_cass,intd1,intm1, int y1)
{
cas_code = t_cas_code;
strcpy(P_name,tP_name);
strcpy(P_address,tP_address);
No_cass = tNo_cass;
dd = d1;
mm = m1;
yy = y1;
fstreamfile;
// Appendsthe transactionrecordintoperson.datdatafile
file.open("person.dat",ios::out|ios::app);
file.write((char*)this,sizeof(account));
file.close();
}
/* Functionfordeletinganaccountfrom person.datfile.*/
voidaccount::delete_account(intt_cas_code)
{
fstreamfile;
file.open("person.dat",ios::in);//Opentoreadrecords
fstreamtemp;
temp.open("TEMP.dat",ios::out);//Opentowrite records
file.seekg(0,ios::beg); // Positionedfrombeginingof the file
// Usesthe copy methodfordeletingthe
// transactionrecordfromperson.datdatafile
while (!file.eof())
{
file.read((char*)this,sizeof(account));
if (file.eof())
break;
if (cas_code != t_cas_code)
temp.write((char*)this,sizeof(account));
}
file.close();
temp.close();
file.open("person.dat",ios::out);
temp.open("TEMP.dat",ios::in);
temp.seekg(0,ios::beg);
// Usescopy methodtotransferthe record
// fromTEMP.dat file toperson.datdatafile
while (!temp.eof())
{
temp.read((char*)this,sizeof(account));
if (temp.eof())
break;
if (cas_code != t_cas_code)
file.write((char*)this,sizeof(account));
}
file.close();
temp.close();
}
// Functionforaddan otherexpensesdetailsinother.datdatafile
voidother::add_to_file(inttO_code,chartNat_Expen[30],
intd1, int m1, int y1, floattamount)
{
O_code = tO_code;
strcpy(Nat_Expen,tNat_Expen);
dd = d1;
mm = m1;
yy = y1;
amount= tamount;
fstreamfile;
// Appendsthe transactionrecordintoother.datdatafile
file.open("other.dat",ios::out|ios::app);
file.write((char*)this,sizeof(other));
file.close();
}
/* Functionfordisplayinganaccountfrom"cassettes.dat".*/
voidcassettes::display_list(void)
{
clrscr();
intflag;
floattot_price = 0.0, tot_balance = 0.0;
fstreamfile;
gotoxy(25,2);
cout << "Listof cassettes/CDsinMusicShop";
gotoxy(25,3);
cout << "===============================";
intd1, m1, y1;
struct date d; // For extractingsystemdate
getdate(&d);
d1 = d.da_day;
m1 = d.da_mon;
y1 = d.da_year;
gotoxy(62,3);
cout << "Date:" << d1 << "/"<< m1 << "/" << y1;
gotoxy(1,4);
for (intj = 1; j <= 79; j++)
cout << "=";
gotoxy(1,5);
cout << "Code #";
gotoxy(9,5);
cout << "Cassette/CDName";
gotoxy(34,5);
cout << "CompanyName";
gotoxy(55,5);
cout << "Qty";
gotoxy(61,5);
cout << "Price";
gotoxy(72, 5);
cout << "Total";
gotoxy(1,6);
for (j = 1; j <= 79; j++)
cout << "=";
file.open("cassettes.dat",ios::in);
file.seekg(0,ios::beg);
introw = 7;
// Readsall the recordsto displayonthe screen
while (file.read((char*)this, sizeof(cassettes)))
{
tot_price = 0.0;
flag= 0;
delay(2);
gotoxy(3,row);
cout << cas_code;
gotoxy(9,row);
puts(Cass_name);
gotoxy(34,row);
puts(Comp_name);
gotoxy(55,row);
cout << tot_cassette;
gotoxy(61,row);
cout << setw(15)
<< setprecision(2)
<< setiosflags(ios::left)
<< setiosflags(ios::showpoint)
<< setiosflags(ios::fixed)
<< price;
tot_price = tot_cassette *price;
gotoxy(72,row);
cout << setw(15)
<< setprecision(2)
<< setiosflags(ios::left)
<< setiosflags(ios::showpoint)
<< setiosflags(ios::fixed)
<< tot_price;
tot_balance = tot_balance + tot_price;
row++;
if (row> 23)
{
flag= 1;
row = 6;
gotoxy(4,24);
cout << "Pressanykeyto continue....";
getch();
clrscr();
}
}
gotoxy(1,row);
for (j = 1; j <= 79; j++)
cout << "=";
row++;
gotoxy(3,row);
cout << "Total price of cassettes/CDsis:";
gotoxy(72,row);
cout << setw(15)
<< setprecision(2)
<< setiosflags(ios::left)
<< setiosflags(ios::showpoint)
<< setiosflags(ios::fixed)
<< tot_balance;
file.close();
if (!flag)
{
gotoxy(4,24);
cout << "Pressanykeyto continue...";
getch();
}
getch();
}
/* Functionfordisplayingancassette/CDsalesondaywise */
voidaccount::Display_sales(void)
{
clrscr();
intflag;
fstreamfile;
inttcas_code;
intxdd,xmm, xyy;
clrscr();
gotoxy(10,8);
cout << "Enterthe cassette/CDCode ";
gotoxy(10,9);
cout <<"As 1 or 2 or 3 ";
gotoxy(10,11);
cout << "Enterthe date " ;
gotoxy(30,9);
cin >> tcas_code;
gotoxy(30,11);
cin >> xdd;
gotoxy(32,11);
cout << "-";
gotoxy(33,11);
cin >> xmm;
gotoxy(35,11);
cout << "-";
gotoxy(36,11);
cin >> xyy;
if (tcas_code < 1)
{
gotoxy(5,23);
cout << "Your entryisnot valid";
getch();
return;
}
else
if (tcas_code > 3)
{
gotoxy(5,23);
cout << "Your entryisnot valid";
getch();
return;
}
clrscr();
gotoxy(25,2);
cout << "SalesReportinMusic Shop";
gotoxy(25,3);
cout << "==========================";
intd1, m1, y1;
struct date d; // For extractingsystemdate
getdate(&d);
d1 = d.da_day;
m1 = d.da_mon;
y1 = d.da_year;
gotoxy(62,3);
cout << "Date:" << d1 << "/"<< m1 << "/" << y1;
gotoxy(1,5);
for (intj = 1; j <= 79; j++)
cout << "=";
gotoxy(1,6);
cout << "Code #";
gotoxy(9,6);
cout << "Name";
gotoxy(34,6);
cout << "Address";
gotoxy(55,6);
cout << "Qty";
gotoxy(61,6);
cout << "Date";
gotoxy(1,7);
for (j = 1; j <= 79; j++)
cout << "=";
file.open("Person.dat",ios::in);
file.seekg(0,ios::beg);
introw = 8;
// Readsall the recordsto displayonthe screen
while (file.read((char*)this,sizeof(account)))
{
if ((tcas_code == cas_code) && (xmm== mm) && (xyy== yy))
{
flag= 0;
delay(2);
gotoxy(3,row);
cout << cas_code;
gotoxy(9,row);
puts(P_name);
gotoxy(34,row);
puts(P_address);
gotoxy(55,row);
cout << No_cass;
gotoxy(61,row);
cout << dd << "-" << mm << "-"<< yy;
++row;
if (row> 23)
{
flag= 1;
row = 6;
gotoxy(4,24);
cout << "Pressanykeyto continue....";
getch();
clrscr();
}
}
}
++row;
gotoxy(1,row);
for (j = 1; j <= 79; j++)
cout << "=";
row++;
file.close();
if (!flag)
{
gotoxy(4,24);
cout << "Pressanykeyto continue...";
getch();
}
getch();
}
/* Functionfordisplayingotherexpensesinshop*/
voidother::display_expense(void)
{
clrscr();
intflag;
fstreamfile;
/* The otherexpence code as:
1 - Salaryto workers,
2 - Electricitybill
3 - Telephone bills
4 - Miscellaneousexpenses*/
inttO_code;
intxdd,xmm, xyy;
clrscr();
gotoxy(10,8);
cout << "Enterthe Expense Code ";
gotoxy(10,9);
cout <<"1 Salaryto Worker ";
gotoxy(10,10);
cout <<"2 Electricitybill ";
gotoxy(10,11);
cout <<"3 Telephone bill ";
gotoxy(10,12);
cout <<"4 Miscellaneous";
gotoxy(10,13);
cout <<"Enter yourChoice";
gotoxy(10,14);
cout << "Enterthe date " ;
gotoxy(30,13);
cin >> tO_code;
gotoxy(30,14);
cin >> xdd;
gotoxy(32,14);
cout << "-";
gotoxy(33,14);
cin >> xmm;
gotoxy(35,14);
cout << "-";
gotoxy(36,14);
cin >> xyy;
if (tO_code < 1)
{
gotoxy(5,23);
cout << "Your entryisnot valid";
getch();
return;
}
else
if (tO_code > 4)
{
gotoxy(5,23);
cout << "Your entryisnot valid";
getch();
return;
}
clrscr();
gotoxy(25,2);
cout << "OtherExpensesinMusicShop";
gotoxy(25,3);
cout << "============================";
intd1, m1, y1;
struct date d; // For extractingsystemdate
getdate(&d);
d1 = d.da_day;
m1 = d.da_mon;
y1 = d.da_year;
gotoxy(62,3);
cout << "Date:" << d1 << "/"<< m1 << "/" << y1;
gotoxy(1,5);
for (intj = 1; j <= 79; j++)
cout << "=";
gotoxy(1,6);
cout << "Code #";
gotoxy(9,6);
cout << "Nature Expense";
gotoxy(34,6);
cout << "Date";
gotoxy(55,6);
cout << "Amount";
gotoxy(1,7);
for (j = 1; j <= 79; j++)
cout << "=";
file.open("other.dat",ios::in);
file.seekg(0,ios::beg);
introw = 8;
// Readsall the recordsto displayonthe screen
while (file.read((char*)this,sizeof(other)))
{
if ((tO_code == O_code) && (xmm== mm) && (xyy== yy))
{
flag= 0;
delay(2);
gotoxy(3,row);
cout << O_code;
gotoxy(9,row);
puts(Nat_Expen);
gotoxy(34,row);
cout << dd << "-" << mm << "-"<< yy;
gotoxy(55,row);
cout << setw(15)
<< setprecision(2)
<< setiosflags(ios::left)
<< setiosflags(ios::showpoint)
<< setiosflags(ios::fixed)
<< amount;
++row;
if (row> 23)
{
flag= 1;
row = 6;
gotoxy(4,24);
cout << "Pressanykeyto continue....";
getch();
clrscr();
}
}
}
++row;
gotoxy(1,row);
for (j = 1; j <= 79; j++)
cout << "=";
row++;
file.close();
if (!flag)
{
gotoxy(4,24);
cout << "Pressanykeyto continue...";
getch();
}
getch();
}
/* Functionforclearingspecifiedrowandcolumn.*/
voidaccount::clear(intcol,introw)
{
for (intj = col;j <= 79; j++)
{
gotoxy(j,row);
cout << " ";
}
}
/* Functionforreturn name of the account
holderfromcassettes.dat.*/
char *cassettes::return_name(intt_cas_code)
{
fstreamfile;
file.open("cassettes.dat",ios::in);
file.seekg(0,ios::beg);
char t_Cass_name[30];
// Returnthe name to displayatreportscreenif found
while (file.read((char*)this,sizeof(cassettes)))
{
if (cas_code == t_cas_code)
{
strcpy(t_Cass_name,Cass_name);
break;
}
}
file.close();
returnt_Cass_name;
}
/* Functionforreturn Comp_name of the account holderfromcassettes.dat.*/
char *cassettes::return_address(intt_cas_code)
{
fstreamfile;
file.open("cassettes.dat",ios::in);
file.seekg(0,ios::beg);
char t_Comp_name[30];
// Returnthe Comp_name todisplayatreport screenif found
while (file.read((char*)this,sizeof(cassettes)))
{
if (cas_code == t_cas_code)
{
strcpy(t_Comp_name,Comp_name);
break;
}
}
file.close();
returnt_Comp_name;
}
voidbalance::monthly_profit()
{
clrscr();
intflag;
fstreamfile;
gotoxy(25,1);
cout << "MonthlyProfitStatement";
gotoxy(25,2);
cout << "========================";
intd1, m1, y1;
struct date d; // For extractingsystemdate
getdate(&d);
d1 = d.da_day;
m1 = d.da_mon;
y1 = d.da_year;
floatT_bal = 0.0;
floatG_bal = 0.0;
gotoxy(55,3);
cout << "Ason Date: " << d1 << "/" << m1 << "/" << y1;
gotoxy(1,4);
for (intj = 1; j <= 79; j++)
cout << "=";
gotoxy(1,5);
cout << "Code #";
gotoxy(15,5);
cout << "Total Balance";
gotoxy(40,5);
cout << "Date";
gotoxy(50,5);
cout << "UnitPrice";
gotoxy(65,5);
cout << "Total Amount";
gotoxy(1,6);
for (j = 1; j <= 79; j++)
cout << "=";
file.open("Tbal.dat",ios::in);
file.seekg(0,ios::beg);
introw = 7;
floatcod1=0.0;
floatcod2=0.0;
floatcod3=0.0;
// Readsall the recordsto displayonthe screen
while (file.read((char*)this,sizeof(balance)))
{
flag= 0;
if (cas_code == 1)
cod1 = price;
else
if (cas_code == 2)
cod2 = price;
else
cod3 = price;
T_bal = cas_bal * price;
delay(2);
gotoxy(3,row);
cout << cas_code;
gotoxy(20,row);
cout << cas_bal;
gotoxy(40,row);
cout << dd <<"-"<< mm << "-" << yy;
gotoxy(53,row);
cout << setw(15)
<< setprecision(2)
<< setiosflags(ios::left)
<< setiosflags(ios::showpoint)
<< setiosflags(ios::fixed)
<< price;
G_bal = G_bal + T_bal;
gotoxy(68,row);
cout << setw(15)
<< setprecision(2)
<< setiosflags(ios::left)
<< setiosflags(ios::showpoint)
<< setiosflags(ios::fixed)
<< T_bal;
T_bal = 0.0;
row++;
if (row> 23)
{
flag= 1;
row = 6;
gotoxy(4,24);
cout << "Pressanykeyto continue....";
getch();
clrscr();
}
}
gotoxy(1,row);
for (j = 1; j <= 79; j++)
cout << "=";
row++;
gotoxy(50,row);
cout << "Grand Total";
gotoxy(68,row);
cout << setw(15)
<< setprecision(2)
<< setiosflags(ios::left)
<< setiosflags(ios::showpoint)
<< setiosflags(ios::fixed)
<< G_bal;
file.close();
row++;
floatsaltotal = 0.0;
account a;
saltotal = a.sales_status(m1,y1,cod1, cod2, cod3); // Will displaythe salesstatus
row++;
gotoxy(1,row);
for (j = 1; j <= 79; j++)
cout << "=";
row++;
gotoxy(5,row);
cout << "Thismonth'sSalesAmount";
gotoxy(50,row);
cout << setw(15)
<< setprecision(2)
<< setiosflags(ios::left)
<< setiosflags(ios::showpoint)
<< setiosflags(ios::fixed)
<< saltotal;
floatgother= 0.0;
otheroth;
gother= oth.other_status(m1,y1);
row = row + 2;
gotoxy(5,row);
cout << "Otherexpenses";
gotoxy(50,row);
cout << setw(15)
<< setprecision(2)
<< setiosflags(ios::left)
<< setiosflags(ios::showpoint)
<< setiosflags(ios::fixed)
<< gother;
row++;
gotoxy(1,row);
for (j = 1; j <= 79; j++)
cout << "=";
row++;
gotoxy(5,row);
cout << "NetProfit";
floatnet_bal = 0.0;
net_bal = (G_bal + saltotal) - gother;
gotoxy(50,row);
cout << setw(15)
<< setprecision(2)
<< setiosflags(ios::left)
<< setiosflags(ios::showpoint)
<< setiosflags(ios::fixed)
<< net_bal;
if (!flag)
{
gotoxy(4,24);
cout << "Pressanykeyto continue...";
getch();
}
getch();
}
// Functiontofindthe salestotal value
floataccount::sales_status(intm1,inty1, floatcod1, floatcod2, floatcod3)
{
fstreamfile;
file.open("Person.dat",ios::in);
file.seekg(0,ios::beg);
// Readsall the recordsto displayonthe screen
floatts = 0.0;
floatgts = 0.0;
while (file.read((char*)this,sizeof(account)))
{
if ((m1 == mm) && (y1 == yy))
{
if (cas_code == 1)
ts = No_cass* cod1;
else
if (cas_code == 2)
ts = No_cass* cod2;
else
ts = No_cass* cod3;
gts = gts+ ts;
ts = 0;
}
}
file.close();
returngts;
}
// Functiontofindthe otherstatus
floatother::other_status(intm1, inty1)
{
fstreamfile;
file.open("other.dat",ios::in);
file.seekg(0,ios::beg);
// Readsall the recordsto displayonthe screen
floatgoth= 0.0;
while (file.read((char*)this,sizeof(other)))
{
if ((m1 == mm) && (y1 == yy))
{
goth = goth + amount;
}
}
file.close();
returngoth;
}
// Functiontodisplaythe balance cassette/CDinmusicshop
voidbalance::balance_cassette(void)
{
clrscr();
intflag;
fstreamfile;
gotoxy(25,1);
cout << "Listof Balance cassettes/CDs";
gotoxy(25,2);
cout << "=========================";
intd1, m1, y1;
struct date d; // For extractingsystemdate
getdate(&d);
d1 = d.da_day;
m1 = d.da_mon;
y1 = d.da_year;
floatT_bal = 0.0;
floatG_bal = 0.0;
gotoxy(55,3);
cout << "Ason Date: " << d1 << "/" << m1 << "/" << y1;
gotoxy(1,4);
for (intj = 1; j <= 79; j++)
cout << "=";
gotoxy(1,5);
cout << "Code #";
gotoxy(15,5);
cout << "Total Balance";
gotoxy(40,5);
cout << "Date";
gotoxy(50,5);
cout << "UnitPrice";
gotoxy(65,5);
cout << "Total Amount";
gotoxy(1,6);
for (j = 1; j <= 79; j++)
cout << "=";
file.open("Tbal.dat",ios::in);
file.seekg(0,ios::beg);
introw = 7;
// Readsall the recordsto displayonthe screen
while (file.read((char*)this,sizeof(balance)))
{
flag= 0;
T_bal = cas_bal * price;
delay(2);
gotoxy(3,row);
cout << cas_code;
gotoxy(20,row);
cout << cas_bal;
gotoxy(40,row);
cout << dd <<"-"<< mm << "-" << yy;
gotoxy(53,row);
cout << setw(15)
<< setprecision(2)
<< setiosflags(ios::left)
<< setiosflags(ios::showpoint)
<< setiosflags(ios::fixed)
<< price;
G_bal = G_bal + T_bal;
gotoxy(68,row);
cout << setw(15)
<< setprecision(2)
<< setiosflags(ios::left)
<< setiosflags(ios::showpoint)
<< setiosflags(ios::fixed)
<< T_bal;
T_bal = 0.0;
row++;
if (row> 23)
{
flag= 1;
row = 6;
gotoxy(4,24);
cout << "Pressanykeyto continue....";
getch();
clrscr();
}
}
gotoxy(1,row);
for (j = 1; j <= 79; j++)
cout << "=";
row++;
gotoxy(50,row);
cout << "Grand Total";
gotoxy(68,row);
cout << setw(15)
<< setprecision(2)
<< setiosflags(ios::left)
<< setiosflags(ios::showpoint)
<< setiosflags(ios::fixed)
<< G_bal;
file.close();
if (!flag)
{
gotoxy(4,24);
cout << "Pressanykeyto continue...";
getch();
}
getch();
}
/* Functionforrecordingthe newcassettes/CDsinshop*/
voidcassettes::new_cassettes(void)
{
char ch;
inti, valid;
clrscr();
// Declaringthe class objectsfordifferentoperationswith
// memberfunctions
account a;
balance bal;
cassettesini;
shape s;
s.box(2,1, 79, 25, 218);
s.box(25,2, 54, 4, 219);
gotoxy(65,2);
cout << "<0>=Exit";
gotoxy(3,3);
for (i = 1; i<= 76; i++)
cprintf("");
textbackground(BLACK);
textcolor(BLACK+BLINK);
textbackground(WHITE);
gotoxy(30,3);
cprintf("AddNew cassette/CD");
textcolor(LIGHTGRAY);
textbackground(BLACK);
intd1, m1, y1; // Declare the variable forpurchase date of cassette/CD
struct date d; // For extractingsystemdate
getdate(&d); // Extract the system.date
d1 = d.da_day;
m1 = d.da_mon;
y1 = d.da_year;
// Declaringthe temporaryvariablesforcassette/CDentry
char c_code[10];
intt_cas_code;
char t_Cass_name[30];
char t_Comp_name[30];
intt_cas;
inttdd, tmm,tyy;
floatt_price;
t_cas_code = ini.last_cas_code();
// Appendsanddeletesafalse record
// to create primarypositionindatafiles
if (t_cas_code == 0)
{
ini.add_to_file(t_cas_code,"abc", "xyz",1,1, 1, 1, 1.1);
ini.delete_cassette(t_cas_code);
bal.add_to_file(t_cas_code,0,0, 0, 0, 0.0);
bal.delete_balance(t_cas_code);
}
gotoxy(4,6);
cout << "Date:" << d1 << '/' << m1 << '/' << y1;
gotoxy(5,8);
cout << "Cassette/CDCode #";
gotoxy(5,10);
cout << "Cassette/CDName :";
gotoxy(5,12);
cout << "CompanyName :";
gotoxy(5,14);
cout << "Total cassettes/CDs:";
gotoxy(5,16);
cout << "IndividualCassette/CDprice :";
gotoxy(5,18);
cout << "Enterthe Date ";
// Stepstoenterthe Cassette/CDcode either1- 2 - 3.
do
{
a.clear(22,8);
a.clear(5,23); // Clearsthe buttommessage
gotoxy(5,23);
cout << "Entercassettes/CDsCode either1/2/3 ";
valid= 1;
gotoxy(22,8);
gets(c_code);
t_cas_code = atoi(c_code);
if (t_cas_code <= 0)
{
valid= 0;
a.clear(5,23);
gotoxy(5,23);
cprintf("7Shouldnototherthan1, 2, 3");
getch();
gotoxy(5,23);
cout << "Entercassettes/CDsCode either1/2/3 ";
}
} while (!valid);
a.clear(5,23);
// Stepstoenterthe Cassette/CDname
do
{
a.clear(22,10);
a.clear(5,23);
gotoxy(5,23);
cout << "EnterName of the Cassette/CD";
valid= 1;
gotoxy(22,10);
gets(t_Cass_name);
strupr(t_Cass_name);
if (t_Cass_name[0] == '0')
return;
if (strlen(t_Cass_name) ==0 || strlen(t_Cass_name) >25)
{
valid= 0;
gotoxy(5,23);
cprintf("7Cassette/CDName shouldnotgreaterthan25");
getch();
}
}while (!valid);
a.clear(5,23);
// Stepstoentercompanyname
do
{
a.clear(22,12);
a.clear(5,23);
gotoxy(5,23);
cout << "EnterCompanyName ";
valid= 1;
gotoxy(22,12);
gets(t_Comp_name);
strupr(t_Comp_name);
if (t_Comp_name[0] == '0')
return;
if (strlen(t_Comp_name) ==0 || strlen(t_Comp_name)>25)
{
valid= 0;
gotoxy(5,23);
cprintf("7CompanyNameshouldnotgreaterthan25");
getch();
}
}while (!valid);
a.clear(5,23);
// Stepstoenterthe total cassettes/CDspurchased
do
{
a.clear(22,14);
a.clear(5,23);
gotoxy(5,23);
cout << "EnterTotal numberof cassettes/CDspurchased";
valid= 1;
gotoxy(22,14);
gets(c_code);
t_cas = atoi(c_code);
if (t_cas == 0)
{
valid= 0;
a.clear(5,23);
gotoxy(5,23);
cprintf("7EntervalidCassette/CDnumber");
getch();
gotoxy(5,23);
cout << "EnterTotal numberof cassettes/CDspurchased";
}
}while (!valid);
a.clear(5,23);
// Stepstoenterthe Cassette/CD/price
do
{
a.clear(35,16);
a.clear(5,23);
gotoxy(5,23);
cout << "Enterindividual Cassette/CDprice";
valid= 1;
gotoxy(35,16);
gets(c_code);
t_price = atof(c_code);
if (t_price <= 0)
{
valid= 0;
gotoxy(5,23);
cprintf("7Entervalidprice forCassette/CD");
getch();
}
}while (!valid);
a.clear(5,23);
// Stepstoenterthe purchase date
a.clear(22,18);
a.clear(5,23);
gotoxy(5,23);
cout << "Enterdate on whichthe Cassette/CDispurchase";
valid= 1;
gotoxy(22,18);
cin >> tdd;
gotoxy(25,18);
cout << "-";
gotoxy(26,18);
cin >> tmm;
gotoxy(28,18);
cout << "-";
gotoxy(29,18);
cin >> tyy;
a.clear(5,23);
do
{
a.clear(5,20);
valid= 1;
gotoxy(5,20);
cout << "Do youwant to save the record<Y/N>: ";
ch = getche();
if (ch == '0')
return;
ch = toupper(ch);
}while (ch!='N' && ch != 'Y');
if (ch == 'N')
return;
// Appendsthe recordscontentsinto
// bothcassettes.datandperson.datdatafiles
ini.add_to_file(t_cas_code,t_Cass_name,t_Comp_name,
t_cas, tdd,tmm, tyy,t_price);
bal.add_to_file(t_cas_code,t_cas,tdd,tmm,tyy,t_price);
}
/* This functionupdate_balance() isusedtoupdate the
balance Cassette/CDinTbal.datdatafile */
voidbalance::Update_balance(intt_cas_code,
intt_cas, int tdd,inttmm, inttyy,floatt_price)
{
intbal = give_balance(t_cas_code);
if (bal > 0)
{
fstreamfile;
file.open("Tbal.dat",ios::in);
fstreamtemp;
temp.open("TEMP.dat",ios::out);
file.seekg(0,ios::beg);
// Usesa copymethodto delete the accountfromTbal.datdata file
while (!file.eof())
{
file.read((char*)this,sizeof(balance));
if (file.eof())
break;
if (cas_code != t_cas_code)
temp.write((char*)this,sizeof(balance));
else
{
cas_code = t_cas_code;
cas_bal = bal - t_cas;
dd = tdd;
mm = tmm;
yy = tyy;
price = t_price;
temp.write((char*)this,sizeof(balance));
}
}
file.close();
temp.close();
file.open("Tbal.dat",ios::out);
temp.open("TEMP.dat",ios::in);
temp.seekg(0,ios::beg);
// Copythe TEMP.dat contentsintoTbal.datdata file
while (!temp.eof())
{
temp.read((char*)this,sizeof(balance));
if (temp.eof())
break;
file.write((char*)this,sizeof(balance));
}
file.close();
temp.close();
}
else
{
cas_code = t_cas_code;
cas_bal = t_cas;
dd = tdd;
mm = tmm;
yy = tyy;
price = t_price;
fstreamfile;
// Appendsnewaccountrecordwiththe price
// intocassettes.datdatafile
file.open("Tbal.dat",ios::out|ios::app);
file.write((char*)this,sizeof(balance));
file.close();
}
}
/* Functionforcreatingnewaccount for new customer.*/
voidaccount::new_account(void)
{
char ch;
inti, valid;
clrscr();
balance bal;
shape s;
s.box(2,1, 79, 25, 218);
s.box(25,2, 54, 4, 219);
gotoxy(65,2);
cout << "<0>=Exit";
gotoxy(3,3);
for (i = 1; i<= 76; i++)
cprintf("");
textbackground(BLACK);
textcolor(BLACK+BLINK);
textbackground(WHITE);
gotoxy(30,3);
cprintf("Salesof cassettes/CDs");
textcolor(LIGHTGRAY);
textbackground(BLACK);
intd1, m1, y1;
struct date d; // For extractingsystemdate
getdate(&d);
d1 = d.da_day;
m1 = d.da_mon;
y1 = d.da_year;
intt_cas_code;
intC_bal = 0;
floatt_price;
char c_code[2];
char tP_name[30]; // PersonName
char tP_address[30]; // PersonAddress
inttNo_cass; // Numberof Cassette/CD
t_cas_code = last_cas_code();
// Appendsanddeletesafalse recordtocreate
// primarypositionindatafiles
if (t_cas_code == 0)
{
add_to_file(t_cas_code,"xxxx","xxxxx",1,1, 1, 1);
delete_account(t_cas_code);
}
gotoxy(5,6);
cout << "Date:" << d1 << '/' << m1 << '/' << y1;
gotoxy(5,8);
cout << "Cassette/CDCode ";
gotoxy(5,10);
cout << "Name of Person: ";
gotoxy(5,12);
cout << "Address:";
gotoxy(5,14);
cout << "Total Cassette/CD:";
// Stepstoenterthe Cassette/CDcode either1- 2 - 3.
do
{
clear(22,8);
clear(5,23); // Clearsthe buttommessage
gotoxy(5,23);
cout << "Entercassettes/CDsCode either1/2/3 ";
valid= 1;
gotoxy(22,8);
gets(c_code);
t_cas_code = atoi(c_code);
if (t_cas_code <= 0)
{
valid= 0;
clear(5,23);
gotoxy(5,23);
cprintf("7Shouldnototherthan1, 2, 3");
getch();
gotoxy(5,23);
cout << "Entercassettes/CDsCode either1/2/3 ";
}
else
{
C_bal = bal.give_balance(t_cas_code);
t_price = bal.return_price(t_cas_code);
if (C_bal > 0)
{
gotoxy(40,8);
cout << "Total cassettes/CDsinShop: " << C_bal;
break;
}
else
{
cout << "There isno Cassette/CDinshop";
return;
}
}
} while (!valid);
clear(5,23);
// Stepstoenterthe name of the purchase person
do
{
clear(22,10);
clear(5,23);
gotoxy(5,23);
cout << "EnterName of the Person";
valid= 1;
gotoxy(22,10);
gets(tP_name);
strupr(tP_name);
if (tP_name[0] == '0')
return;
if (strlen(tP_name) ==0 || strlen(tP_name) >25)
{
valid= 0;
gotoxy(5,23);
cprintf("7Name shouldnotgreaterthan25");
getch();
clear(5,23);
}
}while (!valid);
clear(5,23);
// Stepstoenterthe addressof the purchase person
do
{
clear(22,12);
clear(5,23);
gotoxy(5,23);
cout << "EnterName of the Person";
valid= 1;
gotoxy(22,12);
gets(tP_address);
strupr(tP_address);
if (tP_address[0] =='0')
return;
if (strlen(tP_address) ==0 || strlen(tP_address) >25)
{
valid= 0;
gotoxy(5,23);
cprintf("7Addressshouldnotgreaterthan25");
getch();
clear(5,23);
}
}while (!valid);
clear(5,23);
do
{
clear(22,14);
clear(5,23);
gotoxy(5,23);
cout << "No.of Cassette/CD";
valid= 1;
gotoxy(22,14);
cin >> tNo_cass;
if (tNo_cass> C_bal)
{
valid= 0;
gotoxy(5,23);
cprintf("7The availabilityof Cassette/CDisnotsufficient");
getch();
}
}while (!valid);
clear(5,23);
do
{
clear(5,17);
valid= 1;
gotoxy(5,17);
cout << "Do youwant to save the record<Y/N>: ";
ch = getche();
if (ch == '0')
return;
ch = toupper(ch);
}while (ch!='N' && ch != 'Y');
if (ch == 'N')
return;
// Updatesthe newbalance afterdeductingthe currentsales
// Appendsthe recordscontentsintobothperson.datdatafiles
add_to_file(t_cas_code,tP_name,tP_address,tNo_cass,d1,m1, y1);
bal.Update_balance(t_cas_code,tNo_cass,d1,m1, y1, t_price);
}
/* Functionforenterthe otherexpencesinother.datdatafile.*/
voidother::Expense_other(void)
{
char ch;
inti, valid;
clrscr();
account a;
shape s;
s.box(2,1, 79, 25, 218);
s.box(25,2, 54, 4, 219);
gotoxy(65,2);
cout << "<0>=Exit";
gotoxy(3,3);
for (i = 1; i<= 76; i++)
cprintf("");
textbackground(BLACK);
textcolor(BLACK+BLINK);
textbackground(WHITE);
gotoxy(30,3);
cprintf("OtherExpence inShop");
textcolor(LIGHTGRAY);
textbackground(BLACK);
intd1, m1, y1;
struct date d; // For extractingsystemdate
getdate(&d);
d1 = d.da_day;
m1 = d.da_mon;
y1 = d.da_year;
char c_code[2];
inttO_code; // Otherexpence code
char tNat_Expen[30]; // Nature of expense description
floattamount; // Expense amount
gotoxy(5,6);
cout << "Date:" << d1 << '/' << m1 << '/' << y1;
gotoxy(5,8);
cout << "Expense Code ";
gotoxy(5,10);
cout << "Nature of Expense :";
gotoxy(5,12);
cout << "Amount: ";
// Stepstoenterthe otherexpense code
do
{
a.clear(22,8);
a.clear(5,23); // Clearsthe buttommessage
gotoxy(5,23);
cout << "EnterExpense code Code either1/2/3/4";
valid= 1;
gotoxy(22,8);
gets(c_code);
tO_code = atoi(c_code);
if (tO_code <= 0)
{
valid= 0;
a.clear(5,23);
gotoxy(5,23);
cprintf("7Expence code shouldnototherthan1/2/3/4");
getch();
gotoxy(5,23);
cout << "Enterotherexpense Codeseither1/2/3/4 ";
}
} while (!valid);
a.clear(5,23);
// Stepstoenterthe nature of expense
do
{
a.clear(22,10);
a.clear(5,23);
gotoxy(5,23);
cout << "Enterthe Nature of expense";
valid= 1;
gotoxy(22,10);
gets(tNat_Expen);
strupr(tNat_Expen);
if (tNat_Expen[0] =='0')
return;
if (strlen(tNat_Expen) ==0 ||strlen(tNat_Expen) >25)
{
valid= 0;
gotoxy(5,23);
cprintf("7Nature of expense notgreaterthan25");
getch();
a.clear(5,23);
}
}while (!valid);
a.clear(5,23);
gotoxy(22,12);
cin >> tamount;
do
{
a.clear(5, 17);
valid= 1;
gotoxy(5,17);
cout << "Do youwant to save the record<Y/N>: ";
ch = getche();
if (ch == '0')
return;
ch = toupper(ch);
}while (ch!='N' && ch != 'Y');
if (ch == 'N')
return;
// Appendsthe recordscontentsintoboth person.datdatafiles
if (tamount> 0)
add_to_file(tO_code,tNat_Expen,d1,m1, y1, tamount);
}
/* Functionforreturningthe recordno. forupdatingprice */
intcassettes::recordno(intt_cas_code)
{
fstreamfile;
file.open("cassettes.dat", ios::in);
file.seekg(0,ios::beg);
intcount = 0;
// Findsthe recordpositionincassettes.datdatafile
while (file.read((char*)this,sizeof(cassettes)))
{
count++;
if (t_cas_code == cas_code)
break;
}
file.close();
returncount;
}
/* Functionforclosinganyaccount afterinputingaccountnumber.*/
voidaccount::close_account(void)
{
clrscr();
char t_acc[10];
intt, t_cas_code;
gotoxy(71,1);
cout << "<0>=Exit";
gotoxy(5,5);
cout << "Enterthe account no. ";
gets(t_acc);
t = atoi(t_acc);
t_cas_code = t;
if (t_cas_code == 0)
return;
clrscr();
cassettesini;
balance bal;
if (!bal.give_balance(t_cas_code))
{
gotoxy(5,5);
cout << "7Accountnot found";
getch();
return;
}
gotoxy(71,1);
cout << "<0>=Exit";
gotoxy(3,3);
textbackground(WHITE);
for (inti = 1; i <= 76; i++)
cprintf("");
textbackground(BLACK);
textcolor(BLACK+BLINK);
textbackground(WHITE);
gotoxy(30,3);
cprintf("Closeaccountscreen");
textcolor(LIGHTGRAY);
textbackground(BLACK);
intd1, m1, y1;
struct date d;
getdate(&d);
d1 = d.da_day;
m1 = d.da_mon;
y1 = d.da_year;
gotoxy(5,6);
cout << "Date:" << d1 << "/"<< m1 << "/" << y1;
char ch;
ini.display(t_cas_code);
do
{
clear(5,15);
gotoxy(5,15);
cout << "Close thisaccount<y/n??";
ch = getche();
if (ch == '0')
return;
ch = toupper(ch);
}while (ch!='N' && ch != 'Y');
if (ch == 'N')
return;
// Functioncallstodelete the existingaccountno.
ini.delete_cassette(t_cas_code);
delete_account(t_cas_code);
gotoxy(5,20);
cout << "7AccountDeleted";
gotoxy(5,23);
cout << "Pressanykeyto continue...";
getch();
}
// Main programlogicwhichcontrol the class membersandmemberfunctions.
voidmain(void)
{
main_menu m_menu;
intgdriver= DETECT, gmode,errorcode;
initgraph(&gdriver,&gmode,"");
m_menu.help();
closegraph();
m_menu.control_menu();
}

Mais conteúdo relacionado

Semelhante a Project on Video Library management

_var_www_moodledata_temp_turnitintooltwo_1014058337._Ioan_Tuns-HNDCSD-PJ-19-1...
_var_www_moodledata_temp_turnitintooltwo_1014058337._Ioan_Tuns-HNDCSD-PJ-19-1..._var_www_moodledata_temp_turnitintooltwo_1014058337._Ioan_Tuns-HNDCSD-PJ-19-1...
_var_www_moodledata_temp_turnitintooltwo_1014058337._Ioan_Tuns-HNDCSD-PJ-19-1...Ioan Tuns
 
Report Card making BY Mitul Patel
Report Card making BY Mitul PatelReport Card making BY Mitul Patel
Report Card making BY Mitul PatelMitul Patel
 
12th CBSE Computer Science Project
12th CBSE Computer Science Project12th CBSE Computer Science Project
12th CBSE Computer Science ProjectAshwin Francis
 
IRJET- Student Teacher Integrated Network Ground – “S.T.I.N.G”
IRJET- Student Teacher Integrated Network Ground – “S.T.I.N.G”IRJET- Student Teacher Integrated Network Ground – “S.T.I.N.G”
IRJET- Student Teacher Integrated Network Ground – “S.T.I.N.G”IRJET Journal
 
Project for Student Result System
Project for Student Result SystemProject for Student Result System
Project for Student Result SystemKuMaR AnAnD
 
NUS-ISS Learning Day 2016 - Tiny Components But Big Possibilities
NUS-ISS Learning Day 2016 - Tiny Components But Big PossibilitiesNUS-ISS Learning Day 2016 - Tiny Components But Big Possibilities
NUS-ISS Learning Day 2016 - Tiny Components But Big PossibilitiesNUS-ISS
 
Investigatory Project for Computer Science
Investigatory Project for Computer Science Investigatory Project for Computer Science
Investigatory Project for Computer Science Sonali Sinha
 
IRJET- Monument Informatica Application using AR
IRJET-  	  Monument Informatica Application using ARIRJET-  	  Monument Informatica Application using AR
IRJET- Monument Informatica Application using ARIRJET Journal
 
Adhyyan presentation.pptx
Adhyyan presentation.pptxAdhyyan presentation.pptx
Adhyyan presentation.pptxRashmiM58
 
Structure of C++ - R.D.Sivakumar
Structure of C++ - R.D.SivakumarStructure of C++ - R.D.Sivakumar
Structure of C++ - R.D.SivakumarSivakumar R D .
 
AN ANDROID APPLICATION FOR CAMPUS INFORMATION SYSTEM
AN ANDROID APPLICATION FOR CAMPUS INFORMATION SYSTEMAN ANDROID APPLICATION FOR CAMPUS INFORMATION SYSTEM
AN ANDROID APPLICATION FOR CAMPUS INFORMATION SYSTEMIRJET Journal
 
Computer science project
Computer science projectComputer science project
Computer science projectSandeep Yadav
 
Introducation of CPLDS and Design of Combinational circuit using CPLD
Introducation of CPLDS and Design of Combinational circuit using CPLDIntroducation of CPLDS and Design of Combinational circuit using CPLD
Introducation of CPLDS and Design of Combinational circuit using CPLDHemantChaurasia8
 
Java programming: Elementary programming
Java programming: Elementary programmingJava programming: Elementary programming
Java programming: Elementary programmingKarwan Mustafa Kareem
 
IRJET- College Campus Event Management System
IRJET- College Campus Event Management SystemIRJET- College Campus Event Management System
IRJET- College Campus Event Management SystemIRJET Journal
 

Semelhante a Project on Video Library management (20)

_var_www_moodledata_temp_turnitintooltwo_1014058337._Ioan_Tuns-HNDCSD-PJ-19-1...
_var_www_moodledata_temp_turnitintooltwo_1014058337._Ioan_Tuns-HNDCSD-PJ-19-1..._var_www_moodledata_temp_turnitintooltwo_1014058337._Ioan_Tuns-HNDCSD-PJ-19-1...
_var_www_moodledata_temp_turnitintooltwo_1014058337._Ioan_Tuns-HNDCSD-PJ-19-1...
 
Report Card making BY Mitul Patel
Report Card making BY Mitul PatelReport Card making BY Mitul Patel
Report Card making BY Mitul Patel
 
12th CBSE Computer Science Project
12th CBSE Computer Science Project12th CBSE Computer Science Project
12th CBSE Computer Science Project
 
IRJET- Student Teacher Integrated Network Ground – “S.T.I.N.G”
IRJET- Student Teacher Integrated Network Ground – “S.T.I.N.G”IRJET- Student Teacher Integrated Network Ground – “S.T.I.N.G”
IRJET- Student Teacher Integrated Network Ground – “S.T.I.N.G”
 
Industrial Training report on java
Industrial  Training report on javaIndustrial  Training report on java
Industrial Training report on java
 
Project for Student Result System
Project for Student Result SystemProject for Student Result System
Project for Student Result System
 
Core Java Training report
Core Java Training reportCore Java Training report
Core Java Training report
 
NUS-ISS Learning Day 2016 - Tiny Components But Big Possibilities
NUS-ISS Learning Day 2016 - Tiny Components But Big PossibilitiesNUS-ISS Learning Day 2016 - Tiny Components But Big Possibilities
NUS-ISS Learning Day 2016 - Tiny Components But Big Possibilities
 
Timeline Chat Android Project
Timeline Chat Android ProjectTimeline Chat Android Project
Timeline Chat Android Project
 
Investigatory Project for Computer Science
Investigatory Project for Computer Science Investigatory Project for Computer Science
Investigatory Project for Computer Science
 
IRJET- Monument Informatica Application using AR
IRJET-  	  Monument Informatica Application using ARIRJET-  	  Monument Informatica Application using AR
IRJET- Monument Informatica Application using AR
 
Adhyyan presentation.pptx
Adhyyan presentation.pptxAdhyyan presentation.pptx
Adhyyan presentation.pptx
 
Structure of C++ - R.D.Sivakumar
Structure of C++ - R.D.SivakumarStructure of C++ - R.D.Sivakumar
Structure of C++ - R.D.Sivakumar
 
Nabhiraijain cdac
Nabhiraijain cdac Nabhiraijain cdac
Nabhiraijain cdac
 
CV-Subodh_Thakur
CV-Subodh_ThakurCV-Subodh_Thakur
CV-Subodh_Thakur
 
AN ANDROID APPLICATION FOR CAMPUS INFORMATION SYSTEM
AN ANDROID APPLICATION FOR CAMPUS INFORMATION SYSTEMAN ANDROID APPLICATION FOR CAMPUS INFORMATION SYSTEM
AN ANDROID APPLICATION FOR CAMPUS INFORMATION SYSTEM
 
Computer science project
Computer science projectComputer science project
Computer science project
 
Introducation of CPLDS and Design of Combinational circuit using CPLD
Introducation of CPLDS and Design of Combinational circuit using CPLDIntroducation of CPLDS and Design of Combinational circuit using CPLD
Introducation of CPLDS and Design of Combinational circuit using CPLD
 
Java programming: Elementary programming
Java programming: Elementary programmingJava programming: Elementary programming
Java programming: Elementary programming
 
IRJET- College Campus Event Management System
IRJET- College Campus Event Management SystemIRJET- College Campus Event Management System
IRJET- College Campus Event Management System
 

Último

Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 

Último (20)

Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 

Project on Video Library management

  • 1. COMPUTERPROJECTONTHETOPIC VIDEO LIBRARY MANAGEMENT SYSTEM USING C++ For thefulfillmentofthe Terms andconditionssetsbythec.b.s.e. For thecomputer sciencepracticalpaper Of theallIndiasenior secondaryschool Examination– 2015-16 Submitted By : Project Supervisor : Name :Parv Poddar Mr. Amarnath Yadav Class : XII ”daffodil “ Teacher Of Computer
  • 2. Roll: 6604252 Science D.A.V PublicSchool, D.A.V Public School, Jharsuguda. Jharsuguda. For the fulfillment of the terms and conditions sets by the C.B.S.E. for the Computer Science Practical paper of the All India Senior Secondary School Examination - 2015-16 Submitted by : Project Supervisor :
  • 3. Name : PARV PODDAR MR. Amarnath Yadav Class : XII “Daffodil” Teacher of Computer Science Roll : D.A.V Public School D.A.V Public School Jharsuguda. Jharsuguda. ACKNOWLEDGEMENT This project work has been successful due to the pains taken by many people. It is not possible for me to acknowledge all of them individually. I take this opportunity to express my gratitude to them. However to my Computer Teacher Mr. Amarnath Yadav, I am specially indebted. I am also be held by associates who helped me a lot in this project. I once again thank my Computer teacher for going through the project thoroughly and pointing me about some errors in this project. Finally I thank the members of my family for their support and encouragement.
  • 4. -- Bonafide Certificate This is to certify that the project entitled “Video Library Management System” submitted by of Class XII is in accordance to him. This project is submitted for the fulfillment of conditions laid down for “AISSE 2015-16”. It embodies the work done by us under the supervision and guidance of Mr. Amarnath Yadav (Teacher of Computer Science, D.A.V Public School, Jharsuguda). Signature of the Student Signature of the Teacher
  • 5. Signature of the Principal DECLARATION I, PARV PODDAR, a student of Class – XII of D.A.V Public School, Jharsuguda, do hereby solemnly declare that this project entitled “Video Library Management System “ submitted for the Computer Practical Paper for the AISSE - 2015-16 consists of the original work done by me under the guidance and supervision of our computer teacher Mr. Amarnath Yadav. Place : Jharsuguda
  • 6. Date : Class : XII Roll. No : D.A.V. Public School Jharsuguda Video Library Management System //VideoLibraryManagementSystem // Declarationof headerfiles #include <iostream.h> #include <fstream.h> #include <process.h> #include <string.h> #include <stdio.h> #include <ctype.h> #include <conio.h> #include <dos.h> #include <stdlib.h> #include <iomanip.h> #include <graphics.h> typedef charoption[15]; const intROW = 10, COL = 10; intscan; // To holdthe special charactersformovingthe promptin menu intascii; // To displaythe mainmenuoptions optiona[]={ "NewCassPur", "ListOfPurchase", "DailyCassSales", "SalesReport", "AddOtherExp", "OtherExpRep", "ClosingStock", "MonthlyProfit", "Exit" }; // Functionusedtodo screening classmain_menu { inti,done; public:
  • 7. voidnormalvideo(intx,inty,char*str); voidreversevideo(intx,inty,char*str); voidbox(intx1,inty1,intx2,inty2); char menu(); voidcontrol_menu(); voidhelp(void); }; /* Classmemberfunctionsfordrawingboxes*/ classshape { public: voidline_hor(int,int,int,char); voidline_ver(int,int,int,char); voidbox(int,int,int,int,char); }; // Classcontainsthe cassettes/CDsdeposit of customers classcassettes { public: voidnew_cassettes(void); // Functiontoadd new cassettes/CDsinmusicshop // For cassettes/CDsentryintothe cassettes.datdatafile voidadd_to_file(int,chart_Cass_name[30],char t_Comp_name[30],int,int,int,int,float); voiddisplay_list(void);//Displayingthe cassettes/CDslist voiddelete_cassette(int);//Deletesthe temporarycassetterecord intlast_cas_code(void);//if the file isexistornot char *return_name(int);//Functionfor validationentryof name char *return_address(int);//Functionforvalidationentryof address intrecordno(int); voiddisplay(int);//Todisplaythe cassette/CDinformationaccount private: // Data Membersof cassette.datdatafile intcas_code; // cassette/CDcode - film, nonfilm, religious char Cass_name[30]; // Title of the cassette/CD char Comp_name[30]; // cassette/CDcompany inttot_cassette; // Total cassette/CDpurchased intdd, mm, yy; // Date of purchase floatprice; // Price percassette/CD }; classbalance { public: voidadd_to_file(int,int,int,int,int,float); // Addrecordfor balance cassette/CD voidbalance_cassette(void); // Functiontodisplaythe balance cassette/CD voiddelete_balance(int); // Deletingthe balance fromTbal.dat intgive_balance(int); // returnsthe currentbalance of a particular // cassette/CDcode voidUpdate_balance(int,int,int,int,int,float);//Functionto update balance after cassette/CDsale
  • 8. floatreturn_price(int); // Returnthe cassette/CDprice voidmonthly_profit(void); // Monthlyprofitaftereverytransaction private: // Data membersof Tbal.datdatafile intcas_code; // cassette/CDcode tobe balance intcas_bal; // Total numberof cassettes/CDsinbalance intdd; // Balance date intmm; intyy; floatprice; // Unitprice of cassettes/CDsoncode wise }; // Classcontainsthe customersdailycassette/CDtransactionentry classaccount { public: voidnew_account(void); // Functiontosale cassettes/CDs voidclose_account(void); // Functiontoclose the cassette/CDpurchase voidclear(int,int);//Functiontoperformaclearscreenfunction voidDisplay_sales(void); // Displayingthe salesreportof cassettes/CDs intlast_cas_code(void);//if the file isexistornot floatsales_status(intm1,inty1, floatcod1, floatcod2,floatcod3); private: voidadd_to_file(int,chartP_name[30],char tP_address[30],int,int,int,int);//Functionto add transactionrecords voiddelete_account(int);//Functiontodelete atransactionrecord // Data membersof person.datdatafile intcas_code; // cassette/CDcode - film, nonfilm, religious char P_name[30]; // PersonName char P_address[30]; // PersonAddress intNo_cass; // Numberof cassette/CD intdd, mm, yy; // To store the systemdate/purchase date }; classother { public: // Functiontodisplayotherexpense screenlikesalary, // electricitybill,telephone andmiscellaneousexpences voidExpense_other(void); // Addthe data to Other.datdata file voidadd_to_file(int,chartNat_Expen[30],int,int,int,float); voiddisplay_expense(void); // Displaythe expenses floatother_status(intm1,inty1); private : // Data membersof other.datdatafile
  • 9. intO_code; // Otherexpence code /* The otherexpence code as: 1 - Salaryto workers, 2 - Electricitybill 3 - Telephone bills 4 - Miscellaneousexpenses*/ char Nat_Expen[30]; // Nature of expense description intdd, mm, yy; // Expense date floatamount; // Expense amount }; // Functiontodisplaysall the menupromptmessages // fromthe pointerarray of optiona[] voidmain_menu::normalvideo(intx,inty,char*str) { gotoxy(x,y); cprintf("%s",str); } // Functiontomove the cursor on the menuprompt // witha reverse videocolor voidmain_menu::reversevideo(intx,inty,char*str) { textcolor(5+143); textbackground(WHITE); gotoxy(x,y); cprintf("%s",str); textcolor(GREEN); textbackground(BLACK); } voidmain_menu::box(intx1,inty1,intx2,inty2) { for(intcol=x1;col<x2;col++) { gotoxy(col,y1); cprintf("%c",196); gotoxy(col,y2); cprintf("%c",196); } for(introw=y1;row<y2;row++) { gotoxy(x1,row); cprintf("%c",179); gotoxy(x2,row); cprintf("%c",179); } gotoxy(x1,y1); cprintf("%c",218); gotoxy(x1,y2); cprintf("%c",192); gotoxy(x2,y1); cprintf("%c",191);
  • 10. gotoxy(x2,y2); cprintf("%c",217); } // Displayingthe mainmenuof musicsystem char main_menu::menu() { clrscr(); textcolor(22); box(20,6, 65, 20); box(18,4, 67, 22); textcolor(5+143); gotoxy(36,5); textbackground(BLUE); cprintf("MU S I C"); textbackground(BLACK); textcolor(22); for(i = 1; i < 9; i++) normalvideo(32,i+10,a[i]); reversevideo(32,10,a[0]); i = done = 0; _setcursortype(_NOCURSOR); do { intkey= getch(); switch(key) { case 00: key= getch(); switch(key) { case 72: normalvideo(32,i+10,a[i]); i--; if (i == -1) i = 8; reversevideo(32,i+10,a[i]); break; case 80: normalvideo(32,i+10,a[i]); i++; if (i == 9) i = 0; reversevideo(32,i+10,a[i]); break; } break; case 13: done = 1; } } while (!done);
  • 11. _setcursortype(_NOCURSOR); return(i+49); } /* The functionmain_menu() isusedtodisplaythe mainmenusystem*/ voidmain_menu::control_menu() { char choice; cassettescas; account a; balance bal; otheroth; do { choice = menu(); clrscr(); switch(choice) { case '1': _setcursortype(_NORMALCURSOR); box(3,1, 75, 24); box(5,2, 73, 23); cas.new_cassettes();//New cassette/CDentryfunction break; case '2': box(3, 1, 75, 24); box(5,2, 73, 23); cassettesini; ini.display_list();//Glogal listof cassettes/CDsfunction break; case '3': box(3,1, 75, 24); box(5,2, 73, 23); _setcursortype(_NORMALCURSOR); a.new_account();//Enterthe personwisesale cassette/CD break; case '4': box(3,1, 75, 24); box(5,2, 73, 23); account a; _setcursortype(_NORMALCURSOR); a.Display_sales();//Displaysthe salescassettes/CDs break; case '5': box(3,1, 75, 24); box(5,2, 73, 23);
  • 12. _setcursortype(_NORMALCURSOR); oth.Expense_other();//Entryof otherexpenses break; case '6': box(3,1, 75, 24); box(5,2, 73, 23); gotoxy(10,10); oth.display_expense(); // Displaysthe expenses break; case '7': box(3,1, 75, 24); box(5,2, 73, 23); gotoxy(10,10); bal.balance_cassette();//Functiontodisplaythe balance cassettes/CDsin shop break; case '8' : box(3,1, 75, 24); box(5,2, 73, 23); gotoxy(10,10); // Monthlyprofitaftereverytransaction bal.monthly_profit(); break; case '9' :exit(0); } } while (choice!=8); } /* Functionto drawhorizontal line formenu*/ voidshape::line_hor(intcolumn1,intcolumn2,introw,char c) { for (column1;column1<= column2; column1++) { gotoxy(column1,row); cout << c; } } /* Functionto drawvertical line formenu*/ voidshape::line_ver(introw1,introw2,intcolumn,char c) { for (row1;row1 <= row2; row1++) { gotoxy(column,row1); cout << c; } } /* Functionfordrawingboxesformenu*/ voidshape::box(intcolumn1,introw1,intcolumn2,introw2, char c) { char ch = 218; char c1, c2, c3, c4;
  • 13. char l1 = 196, l2 = 179; if (c == ch) { c1 = 218; c2 = 191; c3 = 217; c4 = 217; l1 = 196; l2 = 179; } else { c1 = c; c2 = c; c3 = c; c4 = c; l1 = c; c2 = c; } gotoxy(column1,row1); cout << c1; gotoxy(column2,row1); cout << c2; gotoxy(column1,row2); cout << c3; gotoxy(column2, row2); cout << c4; column1++; column2--; line_hor(column1,column2,row1,l1);//Horizontal line line_hor(column1,column2,row2,l1); column1--; column2++; row1++; row2--; line_ver(row1,row2,column1,l2);//Vertical line line_ver(row1,row2, column2,l2); } /* Functionto displayhelpaboutthisproject*/ voidmain_menu::help(void) { clrscr(); setbkcolor(7); settextstyle(7,HORIZ_DIR,5); outtextxy(70,20,"WelcometoVideoShop"); settextstyle(2,HORIZ_DIR,5); outtextxy(60,100,"Thisprojectyour can keeprecordof dailymusiccassettes/CDs"); delay(2); outtextxy(60,130,"transaction.Thisprogramis capable of holdinganyno.of cassettes/CDs."); delay(2); outtextxy(60,160,"-Infirstoptionyoucan enternew cassette/CD information");
  • 14. delay(2); outtextxy(60,190,"-Insecondoptionyoucan see the listof all the cassettes/CDs"); delay(2); outtextxy(60,220,"-Inthirdoptionyoucansalesthe cassettes/CDsaccordingtodemand"); delay(2); outtextxy(60,250,"-Throughfourthoptiionyoucansee the salesstatus"); delay(2); outtextxy(60,280,"In the fifthoptionenteryourdailyotherexpenses"); delay(2); outtextxy(60,310,"-Infifthoptionyoucan take monthWise individual accountreport"); delay(2); outtextxy(60,340,"-Insixthoptionyoucantake reportsof otherexpenses"); delay(2); outtextxy(60,370,"Note-:Enteronlyvaliddatawhile youmaintainthispackage"); delay(2); outtextxy(60,400,"-AndlastoptionisQuit(ExitFromMusic Window)"); delay(2); settextstyle(7,HORIZ_DIR,4); outtextxy(80,420,"Pressanykeytocontinue..."); getch(); } /* Functionfordisplayingacassette/CDinformationwhenrequired*/ voidcassettes::display(intt_cas_code) { fstreamfile; file.open("cassettes.dat", ios::in); file.seekg(0,ios::beg); // Displaysthe recordcontentsmatching // witht_cas_code from cassettes.datdatafile while (file.read((char*)this,sizeof(cassettes))) { if (t_cas_code == cas_code) { gotoxy(8,5); cout << "Accountno." << cas_code; gotoxy(10,8); cout << "Name : "; puts(Cass_name); gotoxy(10,9); cout << "ComanyName : "; puts(Comp_name); gotoxy(10,10); cout << "Price : " << setw(15) // setwidth << setprecision(2) //set position of decimal point << setiosflags(ios::left) // setleftjustifiedoutput << setiosflags(ios::showpoint) //alwaysshow decimal point << setiosflags(ios::fixed) // setfixednotationfordisplay << price; break;
  • 15. } } file.close(); } /* Functionto findistheirrecordsincassette.datfile ornot*/ intcassettes::last_cas_code(void) { fstreamfile; file.open("cassettes.dat",ios::in); file.seekg(0,ios::beg); inttcount = 0; intcount = 0; // Foundsthe last account no. while (file.read((char*)this,sizeof(cassettes))) { tcount = cas_code; count = count + tcount; } file.close(); returncount; } /* Functionto findistheirrecordsinfile person.datornot*/ intaccount::last_cas_code(void) { fstreamfile; file.open("Person.dat",ios::in); file.seekg(0,ios::beg); inttcount = 0; intcount = 0; // Foundsthe lastaccount no. while (file.read((char*)this,sizeof(account))) { tcount = cas_code; count = count + tcount; } file.close(); returncount; } /* Functionforreturningbalance cassette/CD. Thisfunctionreturnsthe balance cassette/CDoncode wise to knowthe current balance from"Tbal.dat"datafile.*/ intbalance::give_balance(intt_cas_code) { fstreamfile;
  • 16. file.open("Tbal.dat",ios::in); file.seekg(0,ios::beg); intt_balance = 0; // Givesthe lastbalance of an individualaccount while (file.read((char*)this,sizeof(balance))) { if (file.eof()) break; if (cas_code == t_cas_code) { t_balance = cas_bal; break; } } file.close(); returnt_balance; } // Functiontoreturnthe cassette/CDprice floatbalance::return_price(intt_cas_code) { floatt_price = 0.0; fstreamfile; file.open("Tbal.dat",ios::in); file.seekg(0,ios::beg); // Givesthe lastbalance of an individualaccount while (file.read((char*)this,sizeof(balance))) { if (file.eof()) break; if (cas_code == t_cas_code) { t_price = price; break; } } file.close(); returnt_price; } /* This function add_to_file() isusedtocreate new/freshrecordinthe datafile */ voidcassettes::add_to_file(intt_cas_code,chart_Cass_name[30], char t_Comp_name[30],intt_cas, inttdd, inttmm,int tyy,floatt_price) { cas_code = t_cas_code; strcpy(Cass_name, t_Cass_name); strcpy(Comp_name,t_Comp_name); tot_cassette = t_cas;
  • 17. dd = tdd; mm = tmm; yy = tyy; price = t_price; fstreamfile; // Appendsnewaccountrecordwiththe price intocassettes.datdatafile file.open("cassettes.dat", ios::out|ios::app); file.write((char*)this,sizeof(cassettes)); file.close(); } /* This functionadd_to_file() isusedto create new/freshrecordinthe datafile */ voidbalance::add_to_file(intt_cas_code, intt_cas, int tdd,inttmm, inttyy,float t_price) { intbal = give_balance(t_cas_code); if (bal > 0) { fstreamfile; file.open("Tbal.dat",ios::in); fstreamtemp; temp.open("TEMP.dat",ios::out); file.seekg(0,ios::beg); // Usesa copymethodto delete the cassette/CD // fromcassette.datdatafile while (!file.eof()) { file.read((char*)this,sizeof(balance)); if (file.eof()) break; if (cas_code != t_cas_code) temp.write((char*)this,sizeof(balance)); else { cas_code = t_cas_code; cas_bal = t_cas + bal; dd = tdd; mm = tmm; yy = tyy; price = t_price; temp.write((char*)this,sizeof(balance)); } } file.close(); temp.close(); file.open("Tbal.dat",ios::out); temp.open("TEMP.dat",ios::in);
  • 18. temp.seekg(0,ios::beg); // Copythe TEMP.dat contentsintocassette.datdatafile while (!temp.eof()) { temp.read((char*)this,sizeof(balance)); if (temp.eof()) break; file.write((char*)this,sizeof(balance)); } file.close(); temp.close(); } else { cas_code = t_cas_code; cas_bal = t_cas; dd = tdd; mm = tmm; yy = tyy; price = t_price; fstreamfile; // Appendsnewaccountrecordwiththe // price intocassettes.datdatafile file.open("Tbal.dat",ios::out|ios::app); file.write((char*)this,sizeof(balance)); file.close(); } } // Functionfordeletingaaccount fromcassettes.datfile voidcassettes::delete_cassette(intt_cas_code) { fstreamfile; file.open("cassettes.dat",ios::in); fstreamtemp; temp.open("TEMP.dat",ios::out); file.seekg(0,ios::beg); // Usesa copymethodto delete the account // fromcassette.datdatafile while (!file.eof()) { file.read((char*)this,sizeof(cassettes)); if (file.eof()) break; if (cas_code != t_cas_code) temp.write((char*)this,sizeof(cassettes)); } file.close(); temp.close(); file.open("cassettes.dat",ios::out);
  • 19. temp.open("TEMP.dat",ios::in); temp.seekg(0,ios::beg); // Copythe TEMP.dat contentsintocassette.datdatafile while (!temp.eof()) { temp.read((char*)this,sizeof(cassettes)); if (temp.eof()) break; if (cas_code != t_cas_code) file.write((char*)this,sizeof(cassettes)); } file.close(); temp.close(); } // Functionfordeletingabalance fromTbal.dat file voidbalance::delete_balance(intt_cas_code) { fstreamfile; file.open("Tbal.dat",ios::in); fstreamtemp; temp.open("TEMP.dat",ios::out); file.seekg(0,ios::beg); // Usesa copymethodto delete the accountfromTbal.datdatafile while (!file.eof()) { file.read((char*)this,sizeof(balance)); if (file.eof()) break; if (cas_code != t_cas_code) temp.write((char*)this,sizeof(balance)); } file.close(); temp.close(); file.open("Tbal.dat",ios::out); temp.open("TEMP.dat", ios::in); temp.seekg(0,ios::beg); // Copythe TEMP.dat contentsintoTbal.datdata file while (!temp.eof()) { temp.read((char*)this,sizeof(balance)); if (temp.eof()) break; if (cas_code != t_cas_code) file.write((char*)this,sizeof(balance)); } file.close(); temp.close(); }
  • 20. /* Functionforadd an account detailsof dailytranactionintoperson.datfile.*/ voidaccount::add_to_file(intt_cas_code,chartP_name[30], char tP_address[30],inttNo_cass,intd1,intm1, int y1) { cas_code = t_cas_code; strcpy(P_name,tP_name); strcpy(P_address,tP_address); No_cass = tNo_cass; dd = d1; mm = m1; yy = y1; fstreamfile; // Appendsthe transactionrecordintoperson.datdatafile file.open("person.dat",ios::out|ios::app); file.write((char*)this,sizeof(account)); file.close(); } /* Functionfordeletinganaccountfrom person.datfile.*/ voidaccount::delete_account(intt_cas_code) { fstreamfile; file.open("person.dat",ios::in);//Opentoreadrecords fstreamtemp; temp.open("TEMP.dat",ios::out);//Opentowrite records file.seekg(0,ios::beg); // Positionedfrombeginingof the file // Usesthe copy methodfordeletingthe // transactionrecordfromperson.datdatafile while (!file.eof()) { file.read((char*)this,sizeof(account)); if (file.eof()) break; if (cas_code != t_cas_code) temp.write((char*)this,sizeof(account)); } file.close(); temp.close(); file.open("person.dat",ios::out); temp.open("TEMP.dat",ios::in); temp.seekg(0,ios::beg); // Usescopy methodtotransferthe record // fromTEMP.dat file toperson.datdatafile while (!temp.eof()) {
  • 21. temp.read((char*)this,sizeof(account)); if (temp.eof()) break; if (cas_code != t_cas_code) file.write((char*)this,sizeof(account)); } file.close(); temp.close(); } // Functionforaddan otherexpensesdetailsinother.datdatafile voidother::add_to_file(inttO_code,chartNat_Expen[30], intd1, int m1, int y1, floattamount) { O_code = tO_code; strcpy(Nat_Expen,tNat_Expen); dd = d1; mm = m1; yy = y1; amount= tamount; fstreamfile; // Appendsthe transactionrecordintoother.datdatafile file.open("other.dat",ios::out|ios::app); file.write((char*)this,sizeof(other)); file.close(); } /* Functionfordisplayinganaccountfrom"cassettes.dat".*/ voidcassettes::display_list(void) { clrscr(); intflag; floattot_price = 0.0, tot_balance = 0.0; fstreamfile; gotoxy(25,2); cout << "Listof cassettes/CDsinMusicShop"; gotoxy(25,3); cout << "==============================="; intd1, m1, y1; struct date d; // For extractingsystemdate getdate(&d); d1 = d.da_day; m1 = d.da_mon; y1 = d.da_year; gotoxy(62,3); cout << "Date:" << d1 << "/"<< m1 << "/" << y1; gotoxy(1,4); for (intj = 1; j <= 79; j++) cout << "=";
  • 22. gotoxy(1,5); cout << "Code #"; gotoxy(9,5); cout << "Cassette/CDName"; gotoxy(34,5); cout << "CompanyName"; gotoxy(55,5); cout << "Qty"; gotoxy(61,5); cout << "Price"; gotoxy(72, 5); cout << "Total"; gotoxy(1,6); for (j = 1; j <= 79; j++) cout << "="; file.open("cassettes.dat",ios::in); file.seekg(0,ios::beg); introw = 7; // Readsall the recordsto displayonthe screen while (file.read((char*)this, sizeof(cassettes))) { tot_price = 0.0; flag= 0; delay(2); gotoxy(3,row); cout << cas_code; gotoxy(9,row); puts(Cass_name); gotoxy(34,row); puts(Comp_name); gotoxy(55,row); cout << tot_cassette; gotoxy(61,row); cout << setw(15) << setprecision(2) << setiosflags(ios::left) << setiosflags(ios::showpoint) << setiosflags(ios::fixed) << price; tot_price = tot_cassette *price; gotoxy(72,row); cout << setw(15) << setprecision(2) << setiosflags(ios::left) << setiosflags(ios::showpoint) << setiosflags(ios::fixed) << tot_price; tot_balance = tot_balance + tot_price;
  • 23. row++; if (row> 23) { flag= 1; row = 6; gotoxy(4,24); cout << "Pressanykeyto continue...."; getch(); clrscr(); } } gotoxy(1,row); for (j = 1; j <= 79; j++) cout << "="; row++; gotoxy(3,row); cout << "Total price of cassettes/CDsis:"; gotoxy(72,row); cout << setw(15) << setprecision(2) << setiosflags(ios::left) << setiosflags(ios::showpoint) << setiosflags(ios::fixed) << tot_balance; file.close(); if (!flag) { gotoxy(4,24); cout << "Pressanykeyto continue..."; getch(); } getch(); } /* Functionfordisplayingancassette/CDsalesondaywise */ voidaccount::Display_sales(void) { clrscr(); intflag; fstreamfile; inttcas_code; intxdd,xmm, xyy; clrscr(); gotoxy(10,8); cout << "Enterthe cassette/CDCode "; gotoxy(10,9); cout <<"As 1 or 2 or 3 "; gotoxy(10,11); cout << "Enterthe date " ;
  • 24. gotoxy(30,9); cin >> tcas_code; gotoxy(30,11); cin >> xdd; gotoxy(32,11); cout << "-"; gotoxy(33,11); cin >> xmm; gotoxy(35,11); cout << "-"; gotoxy(36,11); cin >> xyy; if (tcas_code < 1) { gotoxy(5,23); cout << "Your entryisnot valid"; getch(); return; } else if (tcas_code > 3) { gotoxy(5,23); cout << "Your entryisnot valid"; getch(); return; } clrscr(); gotoxy(25,2); cout << "SalesReportinMusic Shop"; gotoxy(25,3); cout << "=========================="; intd1, m1, y1; struct date d; // For extractingsystemdate getdate(&d); d1 = d.da_day; m1 = d.da_mon; y1 = d.da_year; gotoxy(62,3); cout << "Date:" << d1 << "/"<< m1 << "/" << y1; gotoxy(1,5); for (intj = 1; j <= 79; j++) cout << "="; gotoxy(1,6); cout << "Code #"; gotoxy(9,6); cout << "Name"; gotoxy(34,6); cout << "Address"; gotoxy(55,6); cout << "Qty"; gotoxy(61,6);
  • 25. cout << "Date"; gotoxy(1,7); for (j = 1; j <= 79; j++) cout << "="; file.open("Person.dat",ios::in); file.seekg(0,ios::beg); introw = 8; // Readsall the recordsto displayonthe screen while (file.read((char*)this,sizeof(account))) { if ((tcas_code == cas_code) && (xmm== mm) && (xyy== yy)) { flag= 0; delay(2); gotoxy(3,row); cout << cas_code; gotoxy(9,row); puts(P_name); gotoxy(34,row); puts(P_address); gotoxy(55,row); cout << No_cass; gotoxy(61,row); cout << dd << "-" << mm << "-"<< yy; ++row; if (row> 23) { flag= 1; row = 6; gotoxy(4,24); cout << "Pressanykeyto continue...."; getch(); clrscr(); } } } ++row; gotoxy(1,row); for (j = 1; j <= 79; j++) cout << "="; row++; file.close(); if (!flag) { gotoxy(4,24); cout << "Pressanykeyto continue..."; getch(); }
  • 26. getch(); } /* Functionfordisplayingotherexpensesinshop*/ voidother::display_expense(void) { clrscr(); intflag; fstreamfile; /* The otherexpence code as: 1 - Salaryto workers, 2 - Electricitybill 3 - Telephone bills 4 - Miscellaneousexpenses*/ inttO_code; intxdd,xmm, xyy; clrscr(); gotoxy(10,8); cout << "Enterthe Expense Code "; gotoxy(10,9); cout <<"1 Salaryto Worker "; gotoxy(10,10); cout <<"2 Electricitybill "; gotoxy(10,11); cout <<"3 Telephone bill "; gotoxy(10,12); cout <<"4 Miscellaneous"; gotoxy(10,13); cout <<"Enter yourChoice"; gotoxy(10,14); cout << "Enterthe date " ; gotoxy(30,13); cin >> tO_code; gotoxy(30,14); cin >> xdd; gotoxy(32,14); cout << "-"; gotoxy(33,14); cin >> xmm; gotoxy(35,14); cout << "-"; gotoxy(36,14); cin >> xyy; if (tO_code < 1) { gotoxy(5,23); cout << "Your entryisnot valid"; getch(); return;
  • 27. } else if (tO_code > 4) { gotoxy(5,23); cout << "Your entryisnot valid"; getch(); return; } clrscr(); gotoxy(25,2); cout << "OtherExpensesinMusicShop"; gotoxy(25,3); cout << "============================"; intd1, m1, y1; struct date d; // For extractingsystemdate getdate(&d); d1 = d.da_day; m1 = d.da_mon; y1 = d.da_year; gotoxy(62,3); cout << "Date:" << d1 << "/"<< m1 << "/" << y1; gotoxy(1,5); for (intj = 1; j <= 79; j++) cout << "="; gotoxy(1,6); cout << "Code #"; gotoxy(9,6); cout << "Nature Expense"; gotoxy(34,6); cout << "Date"; gotoxy(55,6); cout << "Amount"; gotoxy(1,7); for (j = 1; j <= 79; j++) cout << "="; file.open("other.dat",ios::in); file.seekg(0,ios::beg); introw = 8; // Readsall the recordsto displayonthe screen while (file.read((char*)this,sizeof(other))) { if ((tO_code == O_code) && (xmm== mm) && (xyy== yy)) { flag= 0;
  • 28. delay(2); gotoxy(3,row); cout << O_code; gotoxy(9,row); puts(Nat_Expen); gotoxy(34,row); cout << dd << "-" << mm << "-"<< yy; gotoxy(55,row); cout << setw(15) << setprecision(2) << setiosflags(ios::left) << setiosflags(ios::showpoint) << setiosflags(ios::fixed) << amount; ++row; if (row> 23) { flag= 1; row = 6; gotoxy(4,24); cout << "Pressanykeyto continue...."; getch(); clrscr(); } } } ++row; gotoxy(1,row); for (j = 1; j <= 79; j++) cout << "="; row++; file.close(); if (!flag) { gotoxy(4,24); cout << "Pressanykeyto continue..."; getch(); } getch(); } /* Functionforclearingspecifiedrowandcolumn.*/ voidaccount::clear(intcol,introw) { for (intj = col;j <= 79; j++) { gotoxy(j,row); cout << " "; }
  • 29. } /* Functionforreturn name of the account holderfromcassettes.dat.*/ char *cassettes::return_name(intt_cas_code) { fstreamfile; file.open("cassettes.dat",ios::in); file.seekg(0,ios::beg); char t_Cass_name[30]; // Returnthe name to displayatreportscreenif found while (file.read((char*)this,sizeof(cassettes))) { if (cas_code == t_cas_code) { strcpy(t_Cass_name,Cass_name); break; } } file.close(); returnt_Cass_name; } /* Functionforreturn Comp_name of the account holderfromcassettes.dat.*/ char *cassettes::return_address(intt_cas_code) { fstreamfile; file.open("cassettes.dat",ios::in); file.seekg(0,ios::beg); char t_Comp_name[30]; // Returnthe Comp_name todisplayatreport screenif found while (file.read((char*)this,sizeof(cassettes))) { if (cas_code == t_cas_code) { strcpy(t_Comp_name,Comp_name); break; } } file.close(); returnt_Comp_name; } voidbalance::monthly_profit() { clrscr(); intflag; fstreamfile; gotoxy(25,1); cout << "MonthlyProfitStatement";
  • 30. gotoxy(25,2); cout << "========================"; intd1, m1, y1; struct date d; // For extractingsystemdate getdate(&d); d1 = d.da_day; m1 = d.da_mon; y1 = d.da_year; floatT_bal = 0.0; floatG_bal = 0.0; gotoxy(55,3); cout << "Ason Date: " << d1 << "/" << m1 << "/" << y1; gotoxy(1,4); for (intj = 1; j <= 79; j++) cout << "="; gotoxy(1,5); cout << "Code #"; gotoxy(15,5); cout << "Total Balance"; gotoxy(40,5); cout << "Date"; gotoxy(50,5); cout << "UnitPrice"; gotoxy(65,5); cout << "Total Amount"; gotoxy(1,6); for (j = 1; j <= 79; j++) cout << "="; file.open("Tbal.dat",ios::in); file.seekg(0,ios::beg); introw = 7; floatcod1=0.0; floatcod2=0.0; floatcod3=0.0; // Readsall the recordsto displayonthe screen while (file.read((char*)this,sizeof(balance))) { flag= 0; if (cas_code == 1) cod1 = price; else if (cas_code == 2) cod2 = price; else
  • 31. cod3 = price; T_bal = cas_bal * price; delay(2); gotoxy(3,row); cout << cas_code; gotoxy(20,row); cout << cas_bal; gotoxy(40,row); cout << dd <<"-"<< mm << "-" << yy; gotoxy(53,row); cout << setw(15) << setprecision(2) << setiosflags(ios::left) << setiosflags(ios::showpoint) << setiosflags(ios::fixed) << price; G_bal = G_bal + T_bal; gotoxy(68,row); cout << setw(15) << setprecision(2) << setiosflags(ios::left) << setiosflags(ios::showpoint) << setiosflags(ios::fixed) << T_bal; T_bal = 0.0; row++; if (row> 23) { flag= 1; row = 6; gotoxy(4,24); cout << "Pressanykeyto continue...."; getch(); clrscr(); } } gotoxy(1,row); for (j = 1; j <= 79; j++) cout << "="; row++; gotoxy(50,row); cout << "Grand Total"; gotoxy(68,row); cout << setw(15) << setprecision(2) << setiosflags(ios::left) << setiosflags(ios::showpoint) << setiosflags(ios::fixed) << G_bal; file.close(); row++;
  • 32. floatsaltotal = 0.0; account a; saltotal = a.sales_status(m1,y1,cod1, cod2, cod3); // Will displaythe salesstatus row++; gotoxy(1,row); for (j = 1; j <= 79; j++) cout << "="; row++; gotoxy(5,row); cout << "Thismonth'sSalesAmount"; gotoxy(50,row); cout << setw(15) << setprecision(2) << setiosflags(ios::left) << setiosflags(ios::showpoint) << setiosflags(ios::fixed) << saltotal; floatgother= 0.0; otheroth; gother= oth.other_status(m1,y1); row = row + 2; gotoxy(5,row); cout << "Otherexpenses"; gotoxy(50,row); cout << setw(15) << setprecision(2) << setiosflags(ios::left) << setiosflags(ios::showpoint) << setiosflags(ios::fixed) << gother; row++; gotoxy(1,row); for (j = 1; j <= 79; j++) cout << "="; row++; gotoxy(5,row); cout << "NetProfit"; floatnet_bal = 0.0; net_bal = (G_bal + saltotal) - gother; gotoxy(50,row); cout << setw(15) << setprecision(2) << setiosflags(ios::left) << setiosflags(ios::showpoint) << setiosflags(ios::fixed) << net_bal; if (!flag)
  • 33. { gotoxy(4,24); cout << "Pressanykeyto continue..."; getch(); } getch(); } // Functiontofindthe salestotal value floataccount::sales_status(intm1,inty1, floatcod1, floatcod2, floatcod3) { fstreamfile; file.open("Person.dat",ios::in); file.seekg(0,ios::beg); // Readsall the recordsto displayonthe screen floatts = 0.0; floatgts = 0.0; while (file.read((char*)this,sizeof(account))) { if ((m1 == mm) && (y1 == yy)) { if (cas_code == 1) ts = No_cass* cod1; else if (cas_code == 2) ts = No_cass* cod2; else ts = No_cass* cod3; gts = gts+ ts; ts = 0; } } file.close(); returngts; } // Functiontofindthe otherstatus floatother::other_status(intm1, inty1) { fstreamfile; file.open("other.dat",ios::in); file.seekg(0,ios::beg); // Readsall the recordsto displayonthe screen floatgoth= 0.0; while (file.read((char*)this,sizeof(other))) { if ((m1 == mm) && (y1 == yy)) { goth = goth + amount; } } file.close(); returngoth; }
  • 34. // Functiontodisplaythe balance cassette/CDinmusicshop voidbalance::balance_cassette(void) { clrscr(); intflag; fstreamfile; gotoxy(25,1); cout << "Listof Balance cassettes/CDs"; gotoxy(25,2); cout << "========================="; intd1, m1, y1; struct date d; // For extractingsystemdate getdate(&d); d1 = d.da_day; m1 = d.da_mon; y1 = d.da_year; floatT_bal = 0.0; floatG_bal = 0.0; gotoxy(55,3); cout << "Ason Date: " << d1 << "/" << m1 << "/" << y1; gotoxy(1,4); for (intj = 1; j <= 79; j++) cout << "="; gotoxy(1,5); cout << "Code #"; gotoxy(15,5); cout << "Total Balance"; gotoxy(40,5); cout << "Date"; gotoxy(50,5); cout << "UnitPrice"; gotoxy(65,5); cout << "Total Amount"; gotoxy(1,6); for (j = 1; j <= 79; j++) cout << "="; file.open("Tbal.dat",ios::in); file.seekg(0,ios::beg); introw = 7; // Readsall the recordsto displayonthe screen while (file.read((char*)this,sizeof(balance))) {
  • 35. flag= 0; T_bal = cas_bal * price; delay(2); gotoxy(3,row); cout << cas_code; gotoxy(20,row); cout << cas_bal; gotoxy(40,row); cout << dd <<"-"<< mm << "-" << yy; gotoxy(53,row); cout << setw(15) << setprecision(2) << setiosflags(ios::left) << setiosflags(ios::showpoint) << setiosflags(ios::fixed) << price; G_bal = G_bal + T_bal; gotoxy(68,row); cout << setw(15) << setprecision(2) << setiosflags(ios::left) << setiosflags(ios::showpoint) << setiosflags(ios::fixed) << T_bal; T_bal = 0.0; row++; if (row> 23) { flag= 1; row = 6; gotoxy(4,24); cout << "Pressanykeyto continue...."; getch(); clrscr(); } } gotoxy(1,row); for (j = 1; j <= 79; j++) cout << "="; row++; gotoxy(50,row); cout << "Grand Total"; gotoxy(68,row); cout << setw(15) << setprecision(2) << setiosflags(ios::left) << setiosflags(ios::showpoint) << setiosflags(ios::fixed) << G_bal; file.close(); if (!flag)
  • 36. { gotoxy(4,24); cout << "Pressanykeyto continue..."; getch(); } getch(); } /* Functionforrecordingthe newcassettes/CDsinshop*/ voidcassettes::new_cassettes(void) { char ch; inti, valid; clrscr(); // Declaringthe class objectsfordifferentoperationswith // memberfunctions account a; balance bal; cassettesini; shape s; s.box(2,1, 79, 25, 218); s.box(25,2, 54, 4, 219); gotoxy(65,2); cout << "<0>=Exit"; gotoxy(3,3); for (i = 1; i<= 76; i++) cprintf(""); textbackground(BLACK); textcolor(BLACK+BLINK); textbackground(WHITE); gotoxy(30,3); cprintf("AddNew cassette/CD"); textcolor(LIGHTGRAY); textbackground(BLACK); intd1, m1, y1; // Declare the variable forpurchase date of cassette/CD struct date d; // For extractingsystemdate getdate(&d); // Extract the system.date d1 = d.da_day; m1 = d.da_mon; y1 = d.da_year; // Declaringthe temporaryvariablesforcassette/CDentry char c_code[10]; intt_cas_code; char t_Cass_name[30]; char t_Comp_name[30];
  • 37. intt_cas; inttdd, tmm,tyy; floatt_price; t_cas_code = ini.last_cas_code(); // Appendsanddeletesafalse record // to create primarypositionindatafiles if (t_cas_code == 0) { ini.add_to_file(t_cas_code,"abc", "xyz",1,1, 1, 1, 1.1); ini.delete_cassette(t_cas_code); bal.add_to_file(t_cas_code,0,0, 0, 0, 0.0); bal.delete_balance(t_cas_code); } gotoxy(4,6); cout << "Date:" << d1 << '/' << m1 << '/' << y1; gotoxy(5,8); cout << "Cassette/CDCode #"; gotoxy(5,10); cout << "Cassette/CDName :"; gotoxy(5,12); cout << "CompanyName :"; gotoxy(5,14); cout << "Total cassettes/CDs:"; gotoxy(5,16); cout << "IndividualCassette/CDprice :"; gotoxy(5,18); cout << "Enterthe Date "; // Stepstoenterthe Cassette/CDcode either1- 2 - 3. do { a.clear(22,8); a.clear(5,23); // Clearsthe buttommessage gotoxy(5,23); cout << "Entercassettes/CDsCode either1/2/3 "; valid= 1; gotoxy(22,8); gets(c_code); t_cas_code = atoi(c_code); if (t_cas_code <= 0) { valid= 0; a.clear(5,23); gotoxy(5,23); cprintf("7Shouldnototherthan1, 2, 3"); getch(); gotoxy(5,23); cout << "Entercassettes/CDsCode either1/2/3 ";
  • 38. } } while (!valid); a.clear(5,23); // Stepstoenterthe Cassette/CDname do { a.clear(22,10); a.clear(5,23); gotoxy(5,23); cout << "EnterName of the Cassette/CD"; valid= 1; gotoxy(22,10); gets(t_Cass_name); strupr(t_Cass_name); if (t_Cass_name[0] == '0') return; if (strlen(t_Cass_name) ==0 || strlen(t_Cass_name) >25) { valid= 0; gotoxy(5,23); cprintf("7Cassette/CDName shouldnotgreaterthan25"); getch(); } }while (!valid); a.clear(5,23); // Stepstoentercompanyname do { a.clear(22,12); a.clear(5,23); gotoxy(5,23); cout << "EnterCompanyName "; valid= 1; gotoxy(22,12); gets(t_Comp_name); strupr(t_Comp_name); if (t_Comp_name[0] == '0') return; if (strlen(t_Comp_name) ==0 || strlen(t_Comp_name)>25) { valid= 0; gotoxy(5,23); cprintf("7CompanyNameshouldnotgreaterthan25"); getch(); } }while (!valid); a.clear(5,23); // Stepstoenterthe total cassettes/CDspurchased do { a.clear(22,14);
  • 39. a.clear(5,23); gotoxy(5,23); cout << "EnterTotal numberof cassettes/CDspurchased"; valid= 1; gotoxy(22,14); gets(c_code); t_cas = atoi(c_code); if (t_cas == 0) { valid= 0; a.clear(5,23); gotoxy(5,23); cprintf("7EntervalidCassette/CDnumber"); getch(); gotoxy(5,23); cout << "EnterTotal numberof cassettes/CDspurchased"; } }while (!valid); a.clear(5,23); // Stepstoenterthe Cassette/CD/price do { a.clear(35,16); a.clear(5,23); gotoxy(5,23); cout << "Enterindividual Cassette/CDprice"; valid= 1; gotoxy(35,16); gets(c_code); t_price = atof(c_code); if (t_price <= 0) { valid= 0; gotoxy(5,23); cprintf("7Entervalidprice forCassette/CD"); getch(); } }while (!valid); a.clear(5,23); // Stepstoenterthe purchase date a.clear(22,18); a.clear(5,23); gotoxy(5,23); cout << "Enterdate on whichthe Cassette/CDispurchase"; valid= 1; gotoxy(22,18); cin >> tdd; gotoxy(25,18); cout << "-"; gotoxy(26,18); cin >> tmm;
  • 40. gotoxy(28,18); cout << "-"; gotoxy(29,18); cin >> tyy; a.clear(5,23); do { a.clear(5,20); valid= 1; gotoxy(5,20); cout << "Do youwant to save the record<Y/N>: "; ch = getche(); if (ch == '0') return; ch = toupper(ch); }while (ch!='N' && ch != 'Y'); if (ch == 'N') return; // Appendsthe recordscontentsinto // bothcassettes.datandperson.datdatafiles ini.add_to_file(t_cas_code,t_Cass_name,t_Comp_name, t_cas, tdd,tmm, tyy,t_price); bal.add_to_file(t_cas_code,t_cas,tdd,tmm,tyy,t_price); } /* This functionupdate_balance() isusedtoupdate the balance Cassette/CDinTbal.datdatafile */ voidbalance::Update_balance(intt_cas_code, intt_cas, int tdd,inttmm, inttyy,floatt_price) { intbal = give_balance(t_cas_code); if (bal > 0) { fstreamfile; file.open("Tbal.dat",ios::in); fstreamtemp; temp.open("TEMP.dat",ios::out); file.seekg(0,ios::beg); // Usesa copymethodto delete the accountfromTbal.datdata file while (!file.eof()) { file.read((char*)this,sizeof(balance)); if (file.eof()) break; if (cas_code != t_cas_code) temp.write((char*)this,sizeof(balance)); else
  • 41. { cas_code = t_cas_code; cas_bal = bal - t_cas; dd = tdd; mm = tmm; yy = tyy; price = t_price; temp.write((char*)this,sizeof(balance)); } } file.close(); temp.close(); file.open("Tbal.dat",ios::out); temp.open("TEMP.dat",ios::in); temp.seekg(0,ios::beg); // Copythe TEMP.dat contentsintoTbal.datdata file while (!temp.eof()) { temp.read((char*)this,sizeof(balance)); if (temp.eof()) break; file.write((char*)this,sizeof(balance)); } file.close(); temp.close(); } else { cas_code = t_cas_code; cas_bal = t_cas; dd = tdd; mm = tmm; yy = tyy; price = t_price; fstreamfile; // Appendsnewaccountrecordwiththe price // intocassettes.datdatafile file.open("Tbal.dat",ios::out|ios::app); file.write((char*)this,sizeof(balance)); file.close(); } } /* Functionforcreatingnewaccount for new customer.*/ voidaccount::new_account(void) { char ch; inti, valid;
  • 42. clrscr(); balance bal; shape s; s.box(2,1, 79, 25, 218); s.box(25,2, 54, 4, 219); gotoxy(65,2); cout << "<0>=Exit"; gotoxy(3,3); for (i = 1; i<= 76; i++) cprintf(""); textbackground(BLACK); textcolor(BLACK+BLINK); textbackground(WHITE); gotoxy(30,3); cprintf("Salesof cassettes/CDs"); textcolor(LIGHTGRAY); textbackground(BLACK); intd1, m1, y1; struct date d; // For extractingsystemdate getdate(&d); d1 = d.da_day; m1 = d.da_mon; y1 = d.da_year; intt_cas_code; intC_bal = 0; floatt_price; char c_code[2]; char tP_name[30]; // PersonName char tP_address[30]; // PersonAddress inttNo_cass; // Numberof Cassette/CD t_cas_code = last_cas_code(); // Appendsanddeletesafalse recordtocreate // primarypositionindatafiles if (t_cas_code == 0) { add_to_file(t_cas_code,"xxxx","xxxxx",1,1, 1, 1); delete_account(t_cas_code); } gotoxy(5,6); cout << "Date:" << d1 << '/' << m1 << '/' << y1; gotoxy(5,8); cout << "Cassette/CDCode "; gotoxy(5,10); cout << "Name of Person: "; gotoxy(5,12); cout << "Address:";
  • 43. gotoxy(5,14); cout << "Total Cassette/CD:"; // Stepstoenterthe Cassette/CDcode either1- 2 - 3. do { clear(22,8); clear(5,23); // Clearsthe buttommessage gotoxy(5,23); cout << "Entercassettes/CDsCode either1/2/3 "; valid= 1; gotoxy(22,8); gets(c_code); t_cas_code = atoi(c_code); if (t_cas_code <= 0) { valid= 0; clear(5,23); gotoxy(5,23); cprintf("7Shouldnototherthan1, 2, 3"); getch(); gotoxy(5,23); cout << "Entercassettes/CDsCode either1/2/3 "; } else { C_bal = bal.give_balance(t_cas_code); t_price = bal.return_price(t_cas_code); if (C_bal > 0) { gotoxy(40,8); cout << "Total cassettes/CDsinShop: " << C_bal; break; } else { cout << "There isno Cassette/CDinshop"; return; } } } while (!valid); clear(5,23); // Stepstoenterthe name of the purchase person do { clear(22,10); clear(5,23); gotoxy(5,23); cout << "EnterName of the Person"; valid= 1; gotoxy(22,10); gets(tP_name);
  • 44. strupr(tP_name); if (tP_name[0] == '0') return; if (strlen(tP_name) ==0 || strlen(tP_name) >25) { valid= 0; gotoxy(5,23); cprintf("7Name shouldnotgreaterthan25"); getch(); clear(5,23); } }while (!valid); clear(5,23); // Stepstoenterthe addressof the purchase person do { clear(22,12); clear(5,23); gotoxy(5,23); cout << "EnterName of the Person"; valid= 1; gotoxy(22,12); gets(tP_address); strupr(tP_address); if (tP_address[0] =='0') return; if (strlen(tP_address) ==0 || strlen(tP_address) >25) { valid= 0; gotoxy(5,23); cprintf("7Addressshouldnotgreaterthan25"); getch(); clear(5,23); } }while (!valid); clear(5,23); do { clear(22,14); clear(5,23); gotoxy(5,23); cout << "No.of Cassette/CD"; valid= 1; gotoxy(22,14); cin >> tNo_cass; if (tNo_cass> C_bal) { valid= 0; gotoxy(5,23); cprintf("7The availabilityof Cassette/CDisnotsufficient");
  • 45. getch(); } }while (!valid); clear(5,23); do { clear(5,17); valid= 1; gotoxy(5,17); cout << "Do youwant to save the record<Y/N>: "; ch = getche(); if (ch == '0') return; ch = toupper(ch); }while (ch!='N' && ch != 'Y'); if (ch == 'N') return; // Updatesthe newbalance afterdeductingthe currentsales // Appendsthe recordscontentsintobothperson.datdatafiles add_to_file(t_cas_code,tP_name,tP_address,tNo_cass,d1,m1, y1); bal.Update_balance(t_cas_code,tNo_cass,d1,m1, y1, t_price); } /* Functionforenterthe otherexpencesinother.datdatafile.*/ voidother::Expense_other(void) { char ch; inti, valid; clrscr(); account a; shape s; s.box(2,1, 79, 25, 218); s.box(25,2, 54, 4, 219); gotoxy(65,2); cout << "<0>=Exit"; gotoxy(3,3); for (i = 1; i<= 76; i++) cprintf(""); textbackground(BLACK); textcolor(BLACK+BLINK); textbackground(WHITE); gotoxy(30,3); cprintf("OtherExpence inShop"); textcolor(LIGHTGRAY); textbackground(BLACK); intd1, m1, y1; struct date d; // For extractingsystemdate
  • 46. getdate(&d); d1 = d.da_day; m1 = d.da_mon; y1 = d.da_year; char c_code[2]; inttO_code; // Otherexpence code char tNat_Expen[30]; // Nature of expense description floattamount; // Expense amount gotoxy(5,6); cout << "Date:" << d1 << '/' << m1 << '/' << y1; gotoxy(5,8); cout << "Expense Code "; gotoxy(5,10); cout << "Nature of Expense :"; gotoxy(5,12); cout << "Amount: "; // Stepstoenterthe otherexpense code do { a.clear(22,8); a.clear(5,23); // Clearsthe buttommessage gotoxy(5,23); cout << "EnterExpense code Code either1/2/3/4"; valid= 1; gotoxy(22,8); gets(c_code); tO_code = atoi(c_code); if (tO_code <= 0) { valid= 0; a.clear(5,23); gotoxy(5,23); cprintf("7Expence code shouldnototherthan1/2/3/4"); getch(); gotoxy(5,23); cout << "Enterotherexpense Codeseither1/2/3/4 "; } } while (!valid); a.clear(5,23); // Stepstoenterthe nature of expense do { a.clear(22,10); a.clear(5,23); gotoxy(5,23); cout << "Enterthe Nature of expense"; valid= 1; gotoxy(22,10); gets(tNat_Expen);
  • 47. strupr(tNat_Expen); if (tNat_Expen[0] =='0') return; if (strlen(tNat_Expen) ==0 ||strlen(tNat_Expen) >25) { valid= 0; gotoxy(5,23); cprintf("7Nature of expense notgreaterthan25"); getch(); a.clear(5,23); } }while (!valid); a.clear(5,23); gotoxy(22,12); cin >> tamount; do { a.clear(5, 17); valid= 1; gotoxy(5,17); cout << "Do youwant to save the record<Y/N>: "; ch = getche(); if (ch == '0') return; ch = toupper(ch); }while (ch!='N' && ch != 'Y'); if (ch == 'N') return; // Appendsthe recordscontentsintoboth person.datdatafiles if (tamount> 0) add_to_file(tO_code,tNat_Expen,d1,m1, y1, tamount); } /* Functionforreturningthe recordno. forupdatingprice */ intcassettes::recordno(intt_cas_code) { fstreamfile; file.open("cassettes.dat", ios::in); file.seekg(0,ios::beg); intcount = 0; // Findsthe recordpositionincassettes.datdatafile while (file.read((char*)this,sizeof(cassettes))) { count++; if (t_cas_code == cas_code) break; } file.close();
  • 48. returncount; } /* Functionforclosinganyaccount afterinputingaccountnumber.*/ voidaccount::close_account(void) { clrscr(); char t_acc[10]; intt, t_cas_code; gotoxy(71,1); cout << "<0>=Exit"; gotoxy(5,5); cout << "Enterthe account no. "; gets(t_acc); t = atoi(t_acc); t_cas_code = t; if (t_cas_code == 0) return; clrscr(); cassettesini; balance bal; if (!bal.give_balance(t_cas_code)) { gotoxy(5,5); cout << "7Accountnot found"; getch(); return; } gotoxy(71,1); cout << "<0>=Exit"; gotoxy(3,3); textbackground(WHITE); for (inti = 1; i <= 76; i++) cprintf(""); textbackground(BLACK); textcolor(BLACK+BLINK); textbackground(WHITE); gotoxy(30,3); cprintf("Closeaccountscreen"); textcolor(LIGHTGRAY); textbackground(BLACK); intd1, m1, y1; struct date d; getdate(&d); d1 = d.da_day; m1 = d.da_mon; y1 = d.da_year; gotoxy(5,6); cout << "Date:" << d1 << "/"<< m1 << "/" << y1; char ch; ini.display(t_cas_code);
  • 49. do { clear(5,15); gotoxy(5,15); cout << "Close thisaccount<y/n??"; ch = getche(); if (ch == '0') return; ch = toupper(ch); }while (ch!='N' && ch != 'Y'); if (ch == 'N') return; // Functioncallstodelete the existingaccountno. ini.delete_cassette(t_cas_code); delete_account(t_cas_code); gotoxy(5,20); cout << "7AccountDeleted"; gotoxy(5,23); cout << "Pressanykeyto continue..."; getch(); } // Main programlogicwhichcontrol the class membersandmemberfunctions. voidmain(void) { main_menu m_menu; intgdriver= DETECT, gmode,errorcode; initgraph(&gdriver,&gmode,""); m_menu.help(); closegraph(); m_menu.control_menu(); }