You are on page 1of 43

Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12


th
sci A Page 1

/*---------header file-------------*/
#include<stdio.h>
#include<fstream.h>
#include<conio.h>
#include<math.h>
#include<string.h>
#include<iostream.h>
#include<ctype.h>
#include<iomanip.h>
#include<stdlib.h>
#include<dos.h>
#include<graphics.h>
/*-----------various function involved-----------*/
void box1();
void calculate();
void outline();
void outline1();
void main_menu();
void title();
void carat_box();
void end_title();
void calculate_box();
void del_box();
void name_box();
void del1_box();
/*-------------class for gold items-----------*/
class item
{
public:
int n_pi,cr;
float wt;
char n_code[25],st[25];
int i_code;
int z;
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 2

void title();
void itm_in();
void itm_ser();
void itm_man();
void itm_menu();
}itm;
/*----------------member function------------*/
/*-----------------to insert records-------------*/
void item::itm_in()
{
clrscr();
itm.title();
int l;
gotoxy(23,5);
cout<<" enter the following information...."<<endl;
gotoxy(25,9);
cout<<" code :";
cin>>i_code;
gotoxy(25,11);
cout<<"code name :";
name_box();
gotoxy(45,11);
gets(n_code);
del1_box();
n_code[0]=toupper(n_code[0]);
l=strlen(n_code);
for(int s=0;s<=l;s++)
{
if(n_code[s]==' ')
n_code[s+1]=toupper(n_code[s+1]);
if(n_code[s]=='.')
n_code[s+1]=toupper(n_code[s+1]);
}
gotoxy(25,13);
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 3

cout<<"weight :";
cin>>wt;
gotoxy(25,15);
cout<<"carat :";
carat_box();
gotoxy(25,17);
cout<<"no. of piece :";
cin>>n_pi;
gotoxy(25,19);
cout<<"style :";
cin>>st;
st[0]=toupper(st[0]);
l=strlen(st);
for(s=0;s<=l;s++)
{
if(st[s]==' ')
st[s+1]=toupper(st[s+1]);
if(st[s]=='.')
st[s+1]=toupper(st[s+1]);
}
}
/*--------------member function----------*/
/*-------------------to call gold menu------------------*/
void item::itm_menu()
{
clrscr();
int i;
char ch;
for(i=10;i<=70;++i)
{
gotoxy(i,3); sound(150);
cout<<"+-"; delay(2);
nosound(); delay(20);
}
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 4

cout<<"\n";
for(i=3;i<=24;++i)
{
gotoxy(10,i); sound(100);
cout<<"+-"; cout<<"+-";
delay(2); nosound();
}
cout<<"\n";
for(i=10;i<=70;++i)
{
gotoxy(i,24); sound(2000);
cout<<"+-"; delay(2);
nosound();
}
cout<<"\n";
for(i=24;i>=3;--i)
{
gotoxy(70,i); sound(300);
cout<<"+-"; cout<<"+-";
delay(2); nosound();
}
cout<<"\n";
for(i=7;i<=24;++i)
{
gotoxy(15,i); sound(400);
cout<<"+-"; cout<<"+-";
delay(2); nosound();
}
cout<<"\n";
for(i=24;i>=7;i--)
{
gotoxy(65,i); sound(500);
cout<<"+-"; cout<<"+-";
delay(2); nosound();
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 5

}
cout<<"\n";
for(i=10;i<=71;++i)
{
gotoxy(i,21); sound(600);
cout<<"+-"; delay(2);
nosound();
}
cout<<"\n";
for(i=10;i<=71;++i)
{
gotoxy(i,7); sound(700);
cout<<"+-"; delay(2);
nosound();
}
cout<<"\n";
gotoxy(30,5);
cout<<"menu for gold item...";
gotoxy(20,9);
cout<<"1.press<l/i>to insert records";
gotoxy(20,11);
cout<<"2.press<L/l>to list all records";
gotoxy(20,13);
cout<<"3.press<E/e>to edit specific record";
gotoxy(20,15);
cout<<"4.press<S/s>to search specific record";
gotoxy(20,17);
cout<<"5.press<D/d>to delete specific record";
gotoxy(20,19);
cout<<"6.press<R/r>to return to main menu";
gotoxy(30,22);
cout<<"enter choice :";
highvideo(); textcolor(LIGHTGREEN+BLINK);
gotoxy(30,9); cprintf("l"); gotoxy(32,9); cprintf("i");
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 6

gotoxy(30,11); cprintf("L"); gotoxy(32,11); cprintf("l");
gotoxy(30,13); cprintf("E"); gotoxy(32,13); cprintf("e");
gotoxy(30,15); cprintf("S"); gotoxy(32,15); cprintf("s");
gotoxy(30,17); cprintf("D"); gotoxy(32,17); cprintf("d");
gotoxy(30,19); cprintf("R"); gotoxy(32,19); cprintf("r");
normvideo(); gotoxy(45,22);
}
/*----------------member function---------*/
/*---------------to search records----------*/
void item::itm_ser()
{
clrscr();
int i;
for(i=0;i<80;++i)
{
gotoxy(i,0); cout<<" ";
}
cout<<endl;
for(i=2;i<=23;++i)
{
gotoxy(80,i); cout<<" ";
}
for(i=80;i>0;--i)
{
gotoxy(i,23); cout<<" ";
}
cout<<endl;
for(i=22;i>1;--i)
{
gotoxy(1,i); cout<<" ";
}
cout<<endl;
gotoxy(31,2);
cout<<"record of item....";
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 7

gotoxy(20,5);
cout<<"code :"<<i_code;
gotoxy(20,6);
cout<<"code name :"<<n_code;
gotoxy(20,7);
cout<<"weight :"<<wt;
gotoxy(20,8);
cout<<"carat :"<<cr;
gotoxy(20,9);
cout<<"pieces :"<<n_pi;
gotoxy(20,10);
cout<<"style :"<<st;
gotoxy(20,11);
cout<<"press any key to continue........\n";
getch();
}
/*------------member function-------------*/
/*------------------for box to insertion-------------*/
void item::title()
{
for(int i=17;i<=63;++i)
{gotoxy(i,6);sound(2000);
cout<<char(177);
delay(10);
nosound();
delay(10);
}
cout<<endl;
for(i=7;i<23;++i)
{gotoxy(58,i);sound(3000);
cout<<char(177);
delay(10);
nosound();
delay(10);
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 8

}
cout<<endl;
for(i=63;i>=17;--i)
{gotoxy(i,22);sound(2000);
cout<<char(177);
delay(10);
nosound();
delay(10);
}
cout<<endl;
for(i=21;i>=6;--i)
{gotoxy(22,i);sound(3000);
cout<<char(177);
delay(10);
nosound();
delay(10);
}
cout<<endl;
}
/*--------------------member function---------------*/
/*---------------to manipulate records---------------*/
void item::itm_man()
{
clrscr();
char ch1=0,ch2='y';
int i,flag,s,co_e,n;
item itm;
s=sizeof(itm);
fstream ffill;
itm.itm_menu();
wwf:
ch1=getch();
switch(ch1)
{
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 9

case'I':
case'i':
clrscr();
ffill.open("jewel.dat",ios::out|ios::app|ios::binary);
while(ch2=='y'||ch2=='Y')
{
ffill.seekp(0,ios::end);
itm.itm_in();
ffill.write((char*)&itm,s);
clrscr();
box1(); gotoxy(14,14);
cout<<"more records<y/n>";
ch2=getch(); textmode(C80);
}
ffill.close();
break;
case'l':
case'L':
int z=4;
clrscr();
ffill.open("jewel.dat",ios::in|ios::binary);
outline();
gotoxy(3,2); cout<<"code";
gotoxy(12,2); cout<<"code name";
gotoxy(28,2); cout<<"weight";
gotoxy(40,2); cout<<"carat";
gotoxy(49,2); cout<<"pieces";
gotoxy(58,2); cout<<"style";
cout<<"\n\n\n";
ffill.seekg(ios::beg);
do
{
ffill.read((char*)&itm,s);
if(ffill.eof())
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 10

break;
gotoxy(4,z); cout<<itm.i_code;
gotoxy(15,z); cout<<itm.n_code;
gotoxy(27,z); cout<<itm.wt<<"gms";
gotoxy(41,z); cout<<itm.cr;
gotoxy(51,z); cout<<itm.n_pi;
gotoxy(58,z); cout<<itm.st<<endl;
z++;
}
while (!ffill.eof());
ffill.close();
getch();
break;
case's':
case'S':
clrscr();
ffill.open("jewel.dat",ios::in|ios::binary);
box1(); gotoxy(16,12);
cout<<"enter record";
gotoxy(14,13); cout<<" to be searched";
cin>>co_e;
textmode(C80);
ffill.seekg(0,ios::beg);
ffill.read((char*)&itm,s);
while(!ffill.eof())
{
if(itm.i_code==co_e)
{
itm.itm_ser();
flag=0;
break;
}
ffill.read((char*)&itm,sizeof(itm));
if(itm.i_code!=co_e)
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 11

{
flag=1;
}
}
if(flag==1)
{
clrscr();
box1(); gotoxy(12,14);
cout<<"No such record exists...!!!";
gotoxy(1,25);
getch();
textmode(C80);
}
ffill.close();
break;
case'e':
case'E':
clrscr();
box1();
gotoxy(9,13);
cout<<"which record to modify:";
gotoxy(52,12);
cin>>co_e;
textmode(C80);
ffill.open("jewel.dat",ios::in|ios::out|ios::binary);
ffill.seekg(0);
while(!ffill.eof())
{
ffill.read((char*)&itm,s);
n=ffill.tellg();
if(itm.i_code==co_e)
{
if(ffill.eof())
break;
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 12

cout<<"enter new details \n";
cout<<"enter new details\n";
itm.itm_in();
ffill.seekg(n-s);
ffill.write((char*)&itm,s);
ffill.flush();
clrscr();
box1;
gotoxy(11,13);
cout<<"record has been modified....!";
flag=0;
gotoxy(1,25);
break;
}
if(itm.i_code!=co_e)
{
flag=1;
}
}
if(flag==1)
{clrscr();
box1(); gotoxy(12,15);
cout<<"no such record exists....!!";
gotoxy(1,25);
}
getch();
textmode(C80);
ffill.close();
break;
case'D':
case'd':
fstream temp;
clrscr();
ffill.open("jewel.dat",ios::out|ios::in|ios::binary);
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 13

box1();
gotoxy(10,13);
cout<<"delete whish record:";
cin>>co_e;
textmode(C80);
ffill.seekg(ios::beg);
temp.open("temp.dat",ios::app);
ffill.read((char*)&itm,s);
while(!ffill.eof())
{
if(itm.i_code!=co_e)
{
temp.write((char*)&itm,s);
temp.flush();
}
ffill.read((char*)&itm,s);
}
ffill.close();
temp.close();
remove("jewel.dat");
rename("temp.dat","jewel.dat");
box1();
gotoxy(13,12);
cout<<"specified database";
gotoxy(14,13); cout<<" has been deleted";
gotoxy(16,14); cout<<"(if existed)";
gotoxy(1,25);
getch();
textmode(C80);
break;
default: if(ch1=='r'||ch1=='R')break;
else goto wwf;
}
ffill.close();
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 14

if(ch1=='r'||ch1=='R')
clrscr();
else
itm_man();
}
/*----------------TO CREATE BOX-----------------*/
void outline()
{

int i;
for(i=22;i>1;--i)
{
gotoxy(8,i); cout<<" Y";
}
for(i=22;i>1;--i)
{
gotoxy(24,i); cout<<" Y";
}
for(i=22;i>1;--i)
{
gotoxy(37,i); cout<<" Y";
}
for(i=22;i>1;--i)
{
gotoxy(47,i); cout<<"Y ";
}
for(i=22;i>1;--i)
{
gotoxy(56,i); cout<<"Y ";
}
for(i=0;i<=80;++i)
{
gotoxy(i,1); cout<<"U ";
}
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 15

cout<<endl;
for(i=0;i<80;++i)
{
gotoxy(i,3); cout<<"U ";
}
cout<<endl;
for(i=2;i<23;++i)
{
gotoxy(80,i); cout<<"U ";
}
cout<<endl;
for(i=80;i>0;--i)
{
gotoxy(i,23); cout<<"B ";
}
cout<<endl;
for(i=22;i>1;--i)
{
gotoxy(1,i); cout<<"U ";
}
gotoxy(25,24);
cout<<"press any key to continue.....\n";
}
void box1()
{
textmode(C40);
for(int i=7, j=37;i<=37,j>=7;++i,--j)
{
gotoxy(i,9); cout<<"l";
gotoxy(j,16); cout<<"l";
}
for(i=9, j=16;i<=16,j>=9;++i,--j)
{
gotoxy(36,i); cout<<"o";
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 16

gotoxy(8,j); cout<<"o";
}
gotoxy(9,25);
cout<<"press any key tocontinue.....";
}
void carat_box()
{
int i,j;
for(i=63, j=78;i<=78,j>=63;++i,--j)
{
gotoxy(i,11); cout<<"B";
gotoxy(j,15); cout<<"U";
}
for(i=11, j=15;i<=15,j>=11;++i,--j)
{
gotoxy(63,i); cout<<"U";
gotoxy(78,j); cout<<"U";
}
gotoxy(65,12); cout<<"22 carat";
gotoxy(65,13); cout<<"23 carat";
gotoxy(65,14); cout<<"24 carat";
}
/*-------------------to delete box----------------*/
void del_box()
{
for(int e=11;e<=15;e++)
{gotoxy (63,e);
cout<<" ";
}
}
/*----------------to create box--------------*/
void name_box()
{
for(int i=63, j=78;i<=78,j>=63;++i,--j)
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 17

{
gotoxy(i,9); cout<<"B";
gotoxy(j,17); cout<<"U";
}
for(i=9, j=17;i<=17,j>=9;++i,--j)
{
gotoxy(63,i); cout<<"U";
gotoxy(78,j); cout<<"U";
}
gotoxy(65,11); cout<<"rg->ring";
gotoxy(65,12); cout<<"tp->tops";
gotoxy(65,13); cout<<"jn->chain";
gotoxy(65,14); cout<<"nk->set";
gotoxy(65,15); cout<<"ch->choori";
}
/*-------------------to delete box----------------*/
void del1_box()
{
for(int e=9;e<=17;e++)
{gotoxy (63,e);
cout<<" ";
}
}
/*----------------end of gold class-------------*/
/*----------------class for silver---------------*/
class silver
{
public:
int n_pi,cr;
float wt;
char n_code[25],st[25];
int i_code;
int z;
void title();
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 18

void sil_in();
void sil_ser();
void sil_man();
void sil_menu();
}sil;
/*----------------member function------------*/
/*-----------------to insert records-------------*/
void silver::sil_in()
{
clrscr();
sil.title();
int l;
gotoxy(23,5);
cout<<" enter the following information...."<<endl;
gotoxy(25,10);
cout<<" code :";
cin>>i_code;
gotoxy(25,12);
cout<<"code name :";
name_box();
gotoxy(45,12);
gets(n_code);
del1_box();
n_code[0]=toupper(n_code[0]);
l=strlen(n_code);
for(int s=0;s<=l;s++)
{
if(n_code[s]==' ')
n_code[s+1]=toupper(n_code[s+1]);
if(n_code[s]=='.')
n_code[s+1]=toupper(n_code[s+1]);
}
gotoxy(25,14);
cout<<"weight :";
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 19

cin>>wt;
gotoxy(25,16);
cout<<"no. of piece :";
cin>>n_pi;
gotoxy(25,18);
cout<<"style :";
cin>>st;
st[0]=toupper(st[0]);
l=strlen(st);
for(s=0;s<=l;s++)
{
if(st[s]==' ')
st[s+1]=toupper(st[s+1]);
if(st[s]=='.')
st[s+1]=toupper(st[s+1]);
}
}
/*--------------member function----------*/
/*-------------------to call silver menu------------------*/
void silver::sil_menu()
{
clrscr();
int i;
char ch;
for(i=10;i<=70;++i)
{
gotoxy(i,3); sound(150);
cout<<"+-"; delay(2);
nosound(); delay(20);
}
cout<<"\n";
for(i=3;i<=24;++i)
{
gotoxy(10,i); sound(100);
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 20

cout<<"+-"; cout<<"+-";
delay(2); nosound();
}
cout<<"\n";
for(i=10;i<=70;++i)
{
gotoxy(i,24); sound(2000);
cout<<"+-"; delay(2);
nosound();
}
cout<<"\n";
for(i=24;i>=3;--i)
{
gotoxy(70,i); sound(300);
cout<<"+-"; cout<<"+-";
delay(2); nosound();
}
cout<<"\n";
for(i=7;i<=24;++i)
{
gotoxy(15,i); sound(400);
cout<<"+-"; cout<<"+-";
delay(2); nosound();
}
cout<<"\n";
for(i=24;i>=7;i--)
{
gotoxy(65,i); sound(500);
cout<<"+-"; cout<<"+-";
delay(2); nosound();
}
cout<<"\n";
for(i=10;i<=71;++i)
{
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 21

gotoxy(i,21); sound(600);
cout<<"+-"; delay(2);
nosound();
}
cout<<"\n";
for(i=10;i<=71;++i)
{
gotoxy(i,7); sound(700);
cout<<"+-"; delay(2);
nosound();
}
cout<<"\n";
gotoxy(30,5);
cout<<"menu for silver item...";
gotoxy(20,9);
cout<<"1.press<I/i>to insert records";
gotoxy(20,11);
cout<<"2.press<L/l>to list all records";
gotoxy(20,13);
cout<<"3.press<E/e>to edit specific record";
gotoxy(20,15);
cout<<"4.press<S/s>to search specific record";
gotoxy(20,17);
cout<<"5.press<D/d>to delete specific record";
gotoxy(20,19);
cout<<"6.press<R/r>to return to main menu";
gotoxy(30,22);
cout<<"enter choice :";
highvideo(); textcolor(LIGHTGREEN+BLINK);
gotoxy(30,9); cprintf("I"); gotoxy(32,9); cprintf("i");
gotoxy(30,11); cprintf("L"); gotoxy(32,11); cprintf("l");
gotoxy(30,13); cprintf("E"); gotoxy(32,13); cprintf("e");
gotoxy(30,15); cprintf("S"); gotoxy(32,15); cprintf("s");
gotoxy(30,17); cprintf("D"); gotoxy(32,17); cprintf("d");
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 22

gotoxy(30,19); cprintf("R"); gotoxy(32,19); cprintf("r");
normvideo(); gotoxy(45,22);
}
/*----------------member function---------*/
/*---------------to serach records----------*/
void silver::sil_ser()
{
clrscr();
int i;
for(i=0;i<80;++i)
{
gotoxy(i,0); cout<<" U";
}
cout<<endl;
for(i=2;i<=23;++i)
{
gotoxy(80,i); cout<<" U";
}
for(i=80;i>0;--i)
{
gotoxy(i,23); cout<<" B";
}
cout<<endl;
for(i=22;i>1;--i)
{
gotoxy(1,i); cout<<" U";
}
gotoxy(31,2);
cout<<"record of item....";
gotoxy(20,5);
cout<<"code :"<<i_code;
gotoxy(20,6);
cout<<"code name :"<<n_code;
gotoxy(20,7);
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 23

cout<<"weight :"<<wt;
gotoxy(20,8);
cout<<"pieces :"<<n_pi;
gotoxy(20,9);
cout<<"style :"<<st;
gotoxy(20,11);
cout<<"press any key to continue........\n";
getch();
}
/*--------------------member function---------------*/
/*---------------to manipulate records---------------*/
void silver::sil_man()
{
clrscr();
char ch1=0,ch2='y';
int i,flag,s,co_e,n;
silver sil;
s=sizeof(sil);
fstream ffill;
sil.sil_menu();
wwf:
ch1=getch();
switch(ch1)
{
case'I':
case'i':
clrscr();
ffill.open("jewel.dat",ios::out|ios::app|ios::binary);
while(ch2=='y'||ch2=='Y')
{
ffill.seekp(0,ios::end);
sil.sil_in();
ffill.write((char*)&sil,s);
clrscr();
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 24

box1(); gotoxy(14,14);
cout<<"more records<y/n>";
ch2=getch(); textmode(C80);
}
ffill.close();
break;
case'l':
case'L':
int z=4;
clrscr();
ffill.open("jewel1.dat",ios::in|ios::binary);
outline();
gotoxy(3,2); cout<<"code";
gotoxy(12,2); cout<<"code name";
gotoxy(35,2); cout<<"weight";
gotoxy(50,2); cout<<"pieces";
gotoxy(62,2); cout<<"style";
cout<<"\n\n\n";
ffill.seekg(ios::beg);
do
{
ffill.read((char*)&sil,s);
if(ffill.eof())
break;
gotoxy(4,z); cout<<sil.i_code;
gotoxy(15,z); cout<<sil.n_code;
gotoxy(36,z); cout<<sil.wt<<"gms";
gotoxy(53,z); cout<<sil.n_pi;
gotoxy(62,z); cout<<sil.st<<endl;
z++;
}
while (!ffill.eof());
ffill.close();
getch();
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 25

break;
case's':
case'S':
clrscr();
ffill.open("jewel1.dat",ios::in|ios::binary);
box1(); gotoxy(16,12);
cout<<"enter record";
gotoxy(14,13); cout<<" to be searched :";
cin>>co_e;
textmode(C80);
ffill.seekg(0,ios::beg);
ffill.read((char*)&sil,s);
while(!ffill.eof())
{
if(sil.i_code==co_e)
{
sil.sil_ser();
flag=0;
break;
}
ffill.read((char*)&sil,sizeof(sil));
if(sil.i_code!=co_e)
{
flag=1;
}
}
if(flag==1)
{
clrscr();
box1(); gotoxy(12,14);
cout<<"No such record exists...!!!";
gotoxy(1,25);
getch();
textmode(C80);
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 26

}
ffill.close();
break;
case'e':
case'E':
clrscr();
box1();
gotoxy(9,13);
cout<<"which record to modify:";
gotoxy(52,12);
cin>>co_e;
textmode(C80);
ffill.open("jewel1.dat",ios::in|ios::out|ios::binary);
ffill.seekg(0);
while(!ffill.eof())
{
ffill.read((char*)&sil,s);
n=ffill.tellg();
if(sil.i_code==co_e)
{
if(ffill.eof())
break;
cout<<"enter new details \n";
cout<<"enter new details\n";
sil.sil_in();
ffill.seekg(n-s);
ffill.write((char*)&sil,s);
ffill.flush();
clrscr();
box1;
gotoxy(11,13);
cout<<"record has been modified....!";
flag=0;
gotoxy(1,25);
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 27

break;
}
if(sil.i_code!=co_e)
{
flag=1;
}
}
if(flag==1)
{clrscr();
box1(); gotoxy(12,15);
cout<<"no such record exists....!!";
gotoxy(1,25);
}
getch();
textmode(C80);
ffill.close();
break;
case'D':
case'd':
fstream temp1;
clrscr();
ffill.open("jewel1.dat",ios::out|ios::in|ios::binary);
box1();
gotoxy(10,13);
cout<<"delete which record : ";
cin>>co_e;
textmode(C80);
ffill.seekg(ios::beg);
temp1.open("temp1.dat",ios::app);
ffill.read((char*)&sil,s);
while(!ffill.eof())
{
if(sil.i_code!=co_e)
{ temp1.write((char*)&sil,s);
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 28

temp1.flush();
}
ffill.read((char*)&sil,s);
}
ffill.close();
temp1.close();
remove("jewel1.dat");
rename("temp1.dat","jewel1.dat");
box1();
gotoxy(13,12);
cout<<"specified database";
gotoxy(14,13); cout<<" has been deleted";
gotoxy(16,14); cout<<"(if existed)";
gotoxy(1,25);
getch();
textmode(C80);
break;
default: if(ch1=='r'||ch1=='R')break;
else goto wwf;
}
ffill.close();
if(ch1=='r'||ch1=='R')
clrscr();
else
sil_man();
}
/*------------member function-------------*/
/*------------------for box to insertion-------------*/
void silver::title()
{
for(int i=17;i<=63;++i)
{gotoxy(i,6);sound(2000);
cout<<char(177);
delay(10);
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 29

nosound();
delay(10);
}
cout<<endl;
for(i=7;i<23;++i)
{gotoxy(58,i);sound(3000);
cout<<char(177);
delay(10);
nosound();
delay(10);
}
cout<<endl;
for(i=63;i>=17;--i)
{gotoxy(i,22);sound(2000);
cout<<char(177);
delay(10);
nosound();
delay(10);
}
cout<<endl;
for( i=21;i>=6;--i)
{gotoxy(22,i);sound(3000);
cout<<char(177);
delay(10);
nosound();
delay(10);
}
cout<<endl;
}
/*----------------TO CREATE BOX-----------------*/
void outline1()
{

int i;
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 30

for(i=22;i>1;--i)
{
gotoxy(8,i); cout<<" Y";
}
for(i=22;i>1;--i)
{
gotoxy(30,i); cout<<" Y";
}
for(i=22;i>1;--i)
{
gotoxy(49,i); cout<<" Y";
}
for(i=22;i>1;--i)
{
gotoxy(60,i); cout<<"Y ";
}
for(i=0;i<=80;++i)
{
gotoxy(i,1); cout<<"U ";
}
cout<<endl;
for(i=0;i<80;++i)
{
gotoxy(i,3); cout<<"U ";
}
cout<<endl;
for(i=2;i<23;++i)
{
gotoxy(80,i); cout<<"U ";
}
cout<<endl;
for(i=80;i>0;--i)
{
gotoxy(i,23); cout<<"B ";
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 31

}
cout<<endl;
for(i=22;i>1;--i)
{
gotoxy(1,i); cout<<"U ";
}
gotoxy(25,24);
cout<<"press any key to continue.....\n";
}
/*---------------end of class silver----------------*/
/*++++++++++++main program++++++++++++*/
void main()
{char ch;
clrscr();
title();
do
{
main_menu();
www:
ch=getch();
switch(ch)
{
case'G':
case'g':
clrscr();
itm.itm_man();
break;
case'S':
case's':
clrscr();
sil.sil_man();
break;
case'C':
case'c':
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 32

clrscr();
calculate();
break;
case'E':
case'e':
clrscr();
end_title();
exit(0);
default: goto www;
}
}
while(ch!='e'||ch!='E');
getch();
}
/*------------------to create main menu---------*/
void main_menu()
{
clrscr();
int i;
normvideo();
textcolor(YELLOW);
char ch;
for(i=10;i<=70;++i)
{
gotoxy(i,3); sound(150);
cout<<"+-"; delay(2);
nosound(); delay(20);
}
cout<<"\n";
for(i=3;i<=24;++i)
{
gotoxy(10,i); sound(100);
cout<<"+-"; cout<<"+-";
delay(2); nosound();
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 33

}
cout<<"\n";
for(i=10;i<70;++i)
{
gotoxy(i,24); sound(2000);
cout<<"+-"; delay(2);
nosound();
}
cout<<"\n";
for(i=24;i>=3;--i)
{
gotoxy(70,i); sound(300);
cout<<"+-"; cout<<"+-";
delay(2); nosound();
}
cout<<"\n";
for(i=10;i<=24;++i)
{
gotoxy(15,i); sound(400);
cout<<"+-"; cout<<"+-";
delay(2); nosound();
}
cout<<"\n";
for(i=24;i>=10;--i)
{
gotoxy(65,i); sound(500);
cout<<"+-"; cout<<"+-";
delay(2); nosound();
}
cout<<"\n";
for(i=10;i<=71;++i)
{
gotoxy(i,20); sound(600);
cout<<"+-"; delay(2);
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 34

nosound();
}
cout<<"\n";
for(i=10;i<=71;++i)
{
gotoxy(i,10); sound(700);
cout<<"+-"; delay(2);
nosound();
}
cout<<"\n";
gotoxy(31,6); cout<<"";
gotoxy(34,8); cout<<"main menu";
gotoxy(26,12); cout<<"1.gold ornaments <G/g>";
gotoxy(26,14); cout<<"2.silver ornaments <S/s>";
gotoxy(26,16); cout<<"3.cost of ornaments <C/c>";
gotoxy(26,18); cout<<"4. exit project <E/e> ";
gotoxy(33,22); cout<<"enter choice";
highvideo(); textcolor(LIGHTRED);
gotoxy(26,6); cprintf("!!!........goyal jewellers.......!!!");
textcolor(GREEN+BLINK);
gotoxy(48,12); cout<<"G";
gotoxy(50,12); cout<<"g";
gotoxy(48,14); cout<<"S";
gotoxy(50,14); cout<<"s";
gotoxy(48,16); cout<<"C";
gotoxy(50,16); cout<<"c";
gotoxy(48,18); cout<<"E";
gotoxy(50,18); cout<<"e";
gotoxy(49,22); normvideo();
}
/*----------------to end box------*/
void end_title()
{
for(int i=20;i<61;++i)
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 35

{gotoxy(i,8); sound(2000);
cout<<char(177);
delay(10);
nosound();
delay(10);
}
cout<<endl;
for(i=8;i<21;++i)
{gotoxy(60,i); sound(3000);
cout<<char(177);
delay(10);
nosound();
delay(10);
}
cout<<endl;
for( i=60;i>19;--i)
{gotoxy(i,20); sound(2000);
cout<<char(177);
delay(10);
nosound();
delay(10);
}
cout<<endl;
for(i=20;i>8;--i)
{gotoxy(20,i); sound(3000);
cout<<char(177);
delay(10);
nosound();
delay(10);
}
cout<<endl;
gotoxy(28,12);
cout<<"!!.......thank you........!!\n";
for(i=20;i<61;++i)
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 36

{gotoxy(i,14); sound(2000);
cout<<char(177);
delay(10);
nosound();
delay(10);
}
cout<<endl;
gotoxy(28,16);
cout<<"!!........good bye.......!!\n";
gotoxy(28,24);
cout<<"press any key to continue..\n";
getch();
}
/*-----------to create box for calculation----------*/
void calculate_box()
{
for(int i=20;i<=55;++i)
{
gotoxy(i,8); cout<<"2";
}
cout<<endl;
for(i=20;i<=55;++i)
{
gotoxy(i,16); cout<<"2";
}
cout<<endl;
for(i=9;i<=16;++i)
{
gotoxy(20,i); cout<<"2";
}
cout<<endl;
for(i=16;i>8;--i)
{
gotoxy(55,i); cout<<"2";
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 37

}
}
/*---------function for the calculation----------*/
void calculate()
{
long e;
float rt,wt1;
calculate_box();
gotoxy(26,11); cout<<"enter rate:-";
cin>>rt;
gotoxy(26,13); cout<<"enter weight:-";
cin>>wt1;
e=wt1*rt;
clrscr();
box1(); gotoxy(13,12);
cout<<" the cost in Rs.."<<e;
getch();
textmode(C80);
}
/*------------to create intro box------------*/
void title()
{
clrscr();
textmode(C80);
textcolor(LIGHTGREEN);
int i,j;
for(i=1,j=40;i<=40,j>=1;++i,--j)
{
gotoxy(i,5); sound(5200);
cprintf("+-"); gotoxy(j,21);
cprintf("o"); delay(50);
nosound(); delay(10);
}
textmode(C40);
Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 38

textcolor(RED);
for(i=1,j=25;i<=25,j>=1;++i,--j)
{
gotoxy(35,i); sound(1500);
cprintf("+-U"); gotoxy(5,i);
cprintf("U+-"); delay(10);
nosound(); delay(10);
}
cout<<endl;
gotoxy(7,8); cout<<"!!...welcome to project....!!\n";
gotoxy(11,8); cout<<"stock management of";
gotoxy(12,9); cout<<"jewelery shop of";
gotoxy(7,11); cout<<"g o y a l j e w e l e r s";
gotoxy(14,13); cout<<"developed by.....\n";
gotoxy(17,14); cout<<"ayush";
gotoxy(19,15); cout<<"&";
gotoxy(14,16); cout<<"jay aditya";
gotoxy(16,17); cout<<"12th science";
gotoxy(12,19); cout<<"p.m.s. public school";
gotoxy(16,20); cout<<"moradabad";
gotoxy(7,24); cout<<"press any key to continue.....\n";
gotoxy(40,25);
getch();
textmode(C80);
textcolor(YELLOW);
}








Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 39





Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 40




Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 41








Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 42




Project Report:Computer Science(083)

Submitted by:Ayush Pandey,12
th
sci A Page 43

You might also like