Computer Science Project: Submitted By-Vaibhav Aggarwal Lakshay Banswal Class: XII C Tagore International School
Computer Science Project: Submitted By-Vaibhav Aggarwal Lakshay Banswal Class: XII C Tagore International School
Computer Science Project: Submitted By-Vaibhav Aggarwal Lakshay Banswal Class: XII C Tagore International School
PROJECT
SUBMITTED BY-
VAIBHAV AGGARWAL
LAKSHAY BANSWAL
Class: XII C
TAGORE INTERNATIONAL SCHOOL
CERTIFICATE
char* retos()
{return os;}
char* retbrand()
{return brand;}
char* retmno()
{return mno;}
long retprice()
{return price;}
char* retnm()
{return nm;}
void enter(); // function to enter record
void disp();// function to display records
void dispstock();//function to display stock record
void enterstock();//function to update stock
void bill();//function to decrement stock after every purchase
void generatebill();//function to take information to generate bill
void viewbill();//function to dissplay bill
void displaycust();//function to display customer details
};
//*****************************************************************
**********
void mobi::enter() // function definition for enter();
{ clrscr();
cout<<"\n Enter The Manufacturer's Name:- \n";
gets(brand);
cout<<"\n Enter the model no:- \n";
gets(mno);
cout<<"\n Enter The Price:- \n";
cin>>price;
cout<<"\n Enter The Operating System:-\n";
gets(os);
cout<<"\n Rear Camera:- \n";
cin>>mpr;
cout<<"\n Front Camera:- \n";
cin>>mpf;
cout<<"\n Screen Size:- \n";
cin>>screen;
cout<<"\n Resolution Type:- \n";
gets(resolution_type);
clrscr();
cout<<"\n Processor:- \n";
gets(processor);
cout<<"\n Storage:- \n";
cin>>storage;
cout<<"\n Ram:- \n";
cin>>ram;
if(strcmpi(os,"android")==0)
{cout<<"\n Enter Android Version:- \n";
gets(version);}
else if(strcmpi(os,"ios")==0)
{cout<<"\n Enter IOS Version:- \n";
gets(version);}
else if(strcmpi(os,"windows")==0)
{cout<<"\n Emter The Windows Version:- \n";
gets(version);}
cout<<"\n Enter the number of pieces \n";
cin>>stock;
}
//*****************************************************************
**********
void saveenter()//function to write records into data file
{mobi m; int n,i;
ofstream ofile;
ofile.open("employee.dat",ios::binary|ios::out|ios::app);
clrscr();
cout<<"\n Enter The No. Of Records To Be Entered \n";
cin>>n;
getch();
for(i=0;i<n;i++)
{
m.enter();
ofile.write((char*)&m,sizeof(m));
}
ofile.close();
}
//*****************************************************************
*****
gotoxy(48,18);
cout<<"OPERATING SYSTEM....";
gotoxy(51,21);
cout<<"|";
gotoxy(53,21);
cout<<"OS";
gotoxy(60,21);
cout<<"|";
gotoxy(62,21);
cout<<"Version";
gotoxy(74,21);
cout<<"|";
gotoxy(51,23);
cout<<"|";
gotoxy(53,23);
cout<<os;
gotoxy(60,23);
cout<<"|";
gotoxy(62,23);
cout<<version;
gotoxy(74,23);
cout<<"|";
cout<<"\n Press Enter \n";
getch();
}
//*****************************************************************
*********
void dispinfo() //function to search and display the desired record
{textcolor(CYAN);
mobi m;
char tmno[50];
int flag;
clrscr();
cout<<"\n Enter the model no. \n";
gets(tmno);
ifstream ifile;
ifile.open("employee.dat",ios::binary|ios::in);
while(ifile.read((char*)&m,sizeof(m)))
{flag=0;
if(strcmpi(tmno,m.retmno())==0)
{m.disp();flag=1;break; }
}
if(flag!=1)
{cout<<"\n Invalid Input \n";
getch();
}
ifile.close();
}
//*****************************************************************
*********
void mobi::dispstock()// function to display stock details
{ textcolor(BROWN);
clrscr();
cout<<"\n STOCK DETAILS OF DESIRED MODEL \n";
cout<<"\n Model No.:-\n";
cout<<mno;
cout<<"\n Stock Left:- \n";
cout<<stock;
getch();
textcolor(GREEN);
}
//*****************************************************************
*********
void stocks() // function to take the desired model no and call dispstock();
{ mobi m; char tmno[50]; int flag=0;
cout<<"\n Enter the Model No. to check stock \n";
gets(tmno);
ifstream ifile;
ifile.open("employee.dat",ios::binary|ios::in);
while(ifile.read((char*)&m,sizeof(m)))
{if(strcmpi(tmno,m.retmno())==0)
{ m.dispstock(); flag=1; break; }
}
if(flag!=1)
{cout<<"\n Invalid Input \n";
getch();
}
ifile.close();
}
//*****************************************************************
*
void stockup()// function to take model no. from user and call enterstock();
{ mobi m; char tmno[50]; int flag=0;
cout<<"\n Enter the Model No. to renew stock \n";
gets(tmno);
fstream file;
file.open("employee.dat",ios::binary|ios::out|ios::in);
int pos=sizeof(m);
while(file.read((char*)&m,sizeof(m)))
{if(strcmpi(tmno,m.retmno())==0)
{ file.seekp(-pos,ios::cur);
m.enterstock();
file.write((char*)&m,sizeof(m));
flag=1;break;
}
}
if(flag!=1)
{cout<<"\n Invalid Input \n";
getch();
} file.close();
}
//*****************************************************************
*********
void mobi::enterstock()// function to update stock
{clrscr();
cout<<"\n Enter the No. of pieces available \n";
cin>>stock;
//*****************************************************************
********
void mobi::displaycust()
{ clrscr();
cout<<"\n Name :\t"<<nm;
cout<<"\n Address :\t"<<add;
cout<<"\n Phone :\t"<<ph;
cout<<"\n Item Purchased :\t"<<mno;
cout<<"\n Press Enter For Next \n";
getch();
}
//*****************************************************************
********
void del()//to delete records
{mobi m;
char tmno[50];
cout<<"\n Enter the Model no. \n";
gets(tmno);
ifstream ifile;
ofstream ofile;
ifile.open("employee.dat",ios::binary|ios::in);
ofile.open("empnew.dat",ios::binary|ios::out);
while(!ifile.eof())
{ifile.read((char*)&m,sizeof(m));
if(strcmpi(tmno,m.retmno())!=0)
ofile.write((char*)&m,sizeof(m));}
ifile.close();
ofile.close();
remove("employee.dat");
rename("empnew.dat","employee.dat");
cout<<"\n Successfully Deleted \n";
}
//*****************************************************************
*********
void foremployee()// function for the employee to select the required option.
{
int ec=0;
while(ec!=9)
{textcolor(YELLOW);
clrscr();
cout<<"\n Select the desired option from the given list: \n";
cout<<"\n 1. To Add New Mobile Details. \n";
cout<<"\n 2. To Search Particular Mobile Details. \n";
cout<<"\n 3. To Modify Existing Mobile Details. \n";
cout<<"\n 4. To Delete A Particular Mobile Details. \n";
cout<<"\n 5. To View Customer Details. \n";
cout<<"\n 6. View Customer Details by Name \n";
cout<<"\n 7. To Check For The Stocks Left. \n";
cout<<"\n 8. To Update Stock Details. \n";
cout<<"\n 9. To Go Back To Previous Menu \n";
cin>>ec;
switch(ec)
{case 1 : saveenter();
break;
case 2 : dispinfo();
break;
case 3 : modify();
break;
case 4 : del();
break;
case 5 : dispcustomer();
break;
case 6 : dispcustomernm();
break;
case 7 : stocks();
break;
case 8 : stockup();
break;
case 9 : cout<<"\n Press ENTER \n";
break;
} }
textcolor(LIGHTGREEN);
}
//*****************************************************************
void msamsung() // funnction to search all samsung devices
{ textcolor(LIGHTRED);
mobi m;
ifstream ifile;
ifile.open("employee.dat",ios::binary|ios::in);
while(ifile.read((char*)&m,sizeof(m)))
{if(strcmpi("samsung",m.retbrand())==0)
m.disp();
}
ifile.close();
textcolor(LIGHTGREEN);
}
//*****************************************************************
**********
void mxiaomi() // function to search all xiaomi devices
{ textcolor(LIGHTRED);
mobi m;
ifstream ifile;
ifile.open("employee.dat",ios::binary|ios::in);
while(ifile.read((char*)&m,sizeof(m)))
{if(strcmpi("xiaomi",m.retbrand())==0)
m.disp();
}
ifile.close();
textcolor(LIGHTGREEN);
}
//*****************************************************************
**********
void mgionee() // function to search all gionee devices
{ textcolor(LIGHTRED);
mobi m;
ifstream ifile;
ifile.open("employee.dat",ios::binary|ios::in);
while(ifile.read((char*)&m,sizeof(m)))
{if(strcmpi("gionee",m.retbrand())==0)
m.disp();
}
ifile.close();
textcolor(LIGHTGREEN);
}
//*****************************************************************
void mmicrosoft()// function to search all microsoft devices
{ textcolor(LIGHTRED);
mobi m;
ifstream ifile;
ifile.open("employee.dat",ios::binary|ios::in);
while(ifile.read((char*)&m,sizeof(m)))
{if(strcmpi("microsoft",m.retbrand())==0)
m.disp();
}
ifile.close();
textcolor(LIGHTGREEN);
}
//*****************************************************************
//*****************************************************************
*********
void budget()// function for the user to select budget
{ int bud=0;
while(bud!=6)
{ clrscr();
cout<<"\n Select your range \n";
cout<<"\n 1. Rs10000 to Rs20000 \n";
cout<<"\n 2. Rs20000 to Rs30000 \n";
cout<<"\n 3. Rs30000 to Rs40000 \n";
cout<<"\n 4. Rs40000 to Rs50000 \n";
cout<<"\n 5. Above Rs50000 \n";
cout<<"\n 6. Go Back \n";
cout<<"\n Enter your choice \n";
cin>>bud;
switch(bud)
{case 1 : budget1();
break;
case 2 : budget2();
break;
case 3 : budget3();
break;
case 4 : budget4();
break;
case 5 : budget5();
break;
case 6 : break;
}}
}
//*****************************************************************
**********
void os1()// function definition for os1
{ textcolor(LIGHTBLUE);
mobi m;
ifstream ifile;
ifile.open("employee.dat",ios::binary|ios::in);
while(ifile.read((char*)&m,sizeof(m)))
{if(strcmpi("Android",m.retos())==0)
m.disp();
}
ifile.close();
textcolor(LIGHTGREEN);
}
//*****************************************************************
**********
void os2()// function definition for os2
{ textcolor(LIGHTBLUE);
mobi m;
ifstream ifile;
ifile.open("employee.dat",ios::binary|ios::in);
while(ifile.read((char*)&m,sizeof(m)))
{if(strcmpi("Windows",m.retos())==0)
m.disp();
}
ifile.close();
textcolor(LIGHTGREEN);
}
//*****************************************************************
**********
void os3()// function definition for os3
{ textcolor(LIGHTBLUE);
mobi m;
ifstream ifile;
ifile.open("employee.dat",ios::binary|ios::in);
while(ifile.read((char*)&m,sizeof(m)))
{if(strcmpi("IOS",m.retos())==0)
m.disp();
}
ifile.close();
textcolor(LIGHTGREEN);
}
//*****************************************************************
**********
void os()// function to select operating system
{int o=0;
while(o!=4)
{clrscr();
cout<<"\n Select your desired Operating System \n";
cout<<"\n 1. Android \n";
cout<<"\n 2. Windows \n";
cout<<"\n 3. IOS \n";
cout<<"\n 4. Go Back \n";
cin>>o;
switch(o)
{case 1 : os1();
break;
case 2 : os2();
break;
case 3 : os3();
break;
case 4 : break;
} }
}
//*****************************************************************
**********
void purchase()//function to call bill();
{ mobi m; char tmno[50]; int flag=0;
cout<<"\n Enter the Model No. which you have selected to buy \n";
gets(tmno);
ofstream ofile;
ofile.open("customer.dat",ios::binary|ios::out|ios::app);
fstream file;
file.open("employee.dat",ios::binary|ios::out|ios::in);
int pos=sizeof(m);
while(file.read((char*)&m,sizeof(m)))
{if(strcmpi(tmno,m.retmno())==0)
{ file.seekp(-pos,ios::cur);
m.bill();
file.write((char*)&m,sizeof(m));
m.generatebill();
ofile.write((char*)&m,sizeof(m));
flag=1;
break;
}
}
if(flag!=1)
{cout<<"\n Invalid Input \n";
getch();
} file.close();
}
//*****************************************************************
**********
void mobi::bill()
{stock=stock-1;
getch();
}
//*****************************************************************
**********
void mobi::generatebill()
{
textcolor(BLUE);
clrscr();
cout<<"\nEnter Your Good Name:-\n";
gets(nm);
cout<<"\nEnter Your Address:- \n";
gets(add);
cout<<"\nEnter Your Phone Number:- \n";
cin>>ph;
cout<<"\nEnter Today's Date:-\n";
gets(dt);
viewbill();
}
//*****************************************************************
**********
void mobi::viewbill()
{ clrscr();
}
//*****************************************************************
**********
void main() // main function
{ int x; long pwd;
textcolor(LIGHTBLUE);
clrscr();
cout<<"\n\n\n\n\n\n\t\t\t This project is made by-\n"<<"\t\t\t\t VAIBHAV
AND LAKSHAY "<<"\n \t\t\t\t Class-XII\n";
getch();
textcolor(LIGHTRED);
clrscr();
cout<<"\n\n\n\n\n\n \t\t\t\t **FONEZONE** \n";
cout<<"\n \t\t\t \"The Smartphone Centre\""<<"\n";
getch();
textcolor(LIGHTGREEN);
clrscr();
while(x!=3)
{ clrscr();
cout<<"\n Welcome to FONEZONE! \n";
cout<<"\n Enter your choice \n";
cout<<"\n1. Customer";
cout<<"\n2. Employee";
cout<<"\n3. Exit \n";
cin>>x;
if(x==1)
{forcustomer();}
if(x==2)
{cout<<"\n Enter the password \n";
cin>>pwd;
if(pwd==123456)
foremployee();
else
cout<<"\n Access Denied...\n"; }
if(x==3)
exit(0);
getch(); } getch();}
Outputs-
1.)
2.)
vhnv
3.)
Customer Chooses To Buy One