Add to Favorites    Make Home Page 2067 Online  
 Language Categories  
 Our Services  

Home » C++ Home » Beginners / Lab Assignments Home » Video shop (inventory) - Project.

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title Video shop (inventory) - Project.
Author sumit sood
Author Email sood_sumit19 [at] rediffmail.com
Description This projet is created with the help of files.Graphics is used
in this project

This project is working in boroland C++ compilerin windows 9X/xp/2000/NT
Category C++ » Beginners / Lab Assignments
Hits 371707
Code Select and Copy the Code
//suggestions are welcome //please contact us on e-mail //sood_sumit19@rediffmail.com & chejara_lalit@rediffmail.com #include<conio.h> #include<stdio.h> #include<process.h> #include<iomanip.h> #include<string.h> #include<time.h> #include<fstream.h> #include<graphics.h> #include<dos.h> void displayMe(int,int,char* ,int); void pass_scr(); void search(char *,char *); fstream inoutfile; fstream custfile; static int cod=0; int menu(); class customer { // int code,waitno; char cus_name[30],mo_name[30]; public: char*getname(){return mo_name;} char *getcusname(){return cus_name ;} void getdata(char* m_name,char *c_name) { strcpy(cus_name,c_name); strcpy(mo_name,m_name); } void showdata(int); }; void customer::showdata(int y) { gotoxy(2,y); cprintf(mo_name); gotoxy(22,y); cout<<cus_name; } class dvd { int quantity; char dvdname[30]; float price; public: int code; //dvd(){code=0;} dvd(){code=1;} char*getname(){ return dvdname;} int* getqty(){return &quantity;} void get_data(); void show_data(int); }; void dvd::show_data(int y) { textcolor(15); gotoxy(2,y); cout<<code; gotoxy(13,y); cout<<dvdname; gotoxy(39,y); cout<<quantity; gotoxy(50,y); cout<<price; } void dvd:: get_data() { clrscr(); code=++cod; cout<<"Code no. :-"; cout<<code; gotoxy(2,3); cout<<"Enter the movie name :-"; gets(dvdname); gotoxy(2,4); cout<<"Enter the quantity:- "; cin>>quantity; gotoxy(2,5); cout<<"Enter price:-"; cin>>price; } //Ilustrate main menu int menu() { int c1,c2,c3,c4,c5,c6,c1b,c2b,c3b,c4b,c5b,c6b; int move=1; char ch; time_t t; clrscr(); do { textbackground(0); closegraph(); if (ch == 'H') { if (move == 1) move = 6; else if (move > 1) move--; } else if (ch == 'P') { if (move == 6) move = 1; else if (move < 6) move++; } c1=c2=c3=c4=c5=c6=15; c1b=c2b=c3b=c4b=c5b=c6b=0; // COLOR SELECTION OF A MENU if (move == 1) {c1 = 14; c1b = 4; window(5,8,75,19); textcolor(12|128); gotoxy(2,11); cprintf(" To add new movies in your movie shop "); } else if (move == 2) {c2 = 14; c2b = 4; clrscr(); textcolor(12|128); gotoxy(2,11); cprintf("To display movies in your shop"); } else if (move == 3) {c3 = 14; c3b = 4; clrscr(); textcolor(12|128); gotoxy(2,11); cprintf("To sold any movie available in shop"); } else if (move == 4) {c4 = 14; c4b = 4; clrscr(); textcolor(12|128); gotoxy(2,11); cprintf("To update the waiting list of customer"); } else if (move == 5) {c5 = 14; c5b = 4; clrscr(); textcolor(12|128); gotoxy(2,11); cprintf("To display the waiting list of customer"); } else if (move == 6) {c6 = 14; c6b = 4; clrscr(); textcolor(12|128); gotoxy(2,11); cprintf("To exit "); } window(19,4,60,6); textbackground(6); clrscr(); textcolor(4); clrscr(); gotoxy(13,1); textcolor(0|128); cprintf("COPYRIGHT : SUMIT"); textcolor(1); gotoxy(7,3); cprintf("DATABASE SYSTEM OF A VEDIO SHOP"); // DESIGN OF MAIN MENU window (5,8,75,19); textcolor(c1); textbackground(c1b); cprintf(" 1 ENTER THE NEW MOVIE "); textcolor(c2); textbackground(c2b); cprintf(" 2 DISPLAY (MOVIES LIST)"); textcolor(c3); textbackground(c3b); cprintf(" 3 MOVIE REQUEST"); textcolor(c4); textbackground(c4b); cprintf(" 4 UPDATION OF WAITING LIST OF CUSTOMERS"); textcolor(c5); textbackground(c5b); cprintf(" 5 LIST OF WAITING CUSTOMER"); textcolor(c6); textbackground(c6b); cprintf(" 6 EXIT "); textcolor(15); textbackground(0); gotoxy(4,9); cprintf ("OPTION SELECTED :%i ",move); sound(1000); delay(14);nosound(); window(5,22,75,23); textcolor(2); textbackground(1); /************* Logic of time as a status bar***************/ while(!kbhit()) { clrscr(); time(&t); cprintf(ctime(&t)); delay(40); } ch=getch(); window(5,8,75,19); gotoxy(1,1); textcolor(15); textbackground(0); } while (ch != 13); if (ch==13) { sound(2000); delay(300); sound(1000); delay(100); nosound(); } return move; } /********** Main menu begins ***********/ void main() { int gdriver = DETECT, gmode; initgraph(&gdriver, &gmode, "d:\turboc3\bgi"); int dly =400; for ( int i=1;i<=9;i++) { cleardevice(); settextstyle( DEFAULT_FONT, HORIZ_DIR, 4); setcolor(i); moveto(100,100); outtext("PROJECT OF C++"); delay(dly); } for ( i=1;i<=9;i++) { cleardevice(); settextstyle( DEFAULT_FONT, HORIZ_DIR, 4); setcolor(i); moveto(100,150); outtext("SUBMITTED BY"); delay(dly); } for ( i=1;i<=9;i++) { cleardevice(); settextstyle( DEFAULT_FONT, HORIZ_DIR, 4); setcolor(i); moveto(100,200); outtext("SUMIT & LALIT "); line(70,235,550,235); delay(dly); } setcolor(WHITE); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); outtextxy(10,460,"PRESS ANY KEY TO CONTINUE..."); getch(); pass_scr(); closegraph(); int n,tot=0; do{ n=menu(); clrscr(); switch(n) { case 1: //To add new movies dvd adddata; tot=0; inoutfile.open("cd1.txt",ios::nocreate|ios::in|ios::binary); if(inoutfile) { while(!inoutfile.eof()) { inoutfile.read((char*)&adddata,sizeof(adddata)); cod=adddata.code; tot++; } inoutfile.close(); } inoutfile.open("cd1.txt",ios::app|ios::binary|ios::out); adddata.get_data(); inoutfile.write((char*)&adddata,sizeof(adddata)); tot++; inoutfile.close(); gotoxy(4,12); cprintf("You have to add %d ",30-tot); cprintf(" movies"); getch(); clrscr(); break; case 2: //to display movies dvd display; int y,a=0; tot=0; inoutfile.open("cd1.txt",ios::binary|ios::in); textcolor(15); gotoxy(1,0); for(int l=1;l<=60;l++) cprintf("-"); gotoxy(2,2); cprintf("CODE No."); gotoxy(13,2); cprintf("MOVIE NAME"); gotoxy(37,2); cprintf("QUANTITY"); gotoxy(50,2); cprintf("PRICE"); gotoxy(1,3); for( l=1;l<=60;l++) cprintf("-"); y=4; while(inoutfile) { inoutfile.read((char*)&display,sizeof(display)); if(!inoutfile.eof()) { display.show_data(y++); tot++; a++; } if(a==7) { textcolor(1|128); cprintf(" %10s Press any key to continue..."); textcolor(15); getch(); a=0; clrscr(); textcolor(15); gotoxy(1,0); for(int l=1;l<=60;l++) cprintf("-"); gotoxy(2,2); cprintf("CODE No."); gotoxy(13,2); cprintf("MOVIE NAME"); gotoxy(37,2); cprintf("QUANTITY"); gotoxy(50,2); cprintf("PRICE"); gotoxy(1,3); for( l=1;l<=60;l++) cprintf("-"); y=4; } } gotoxy(4,12); cprintf("Total movies = %d",tot); gotoxy(34,12); cprintf("movies required =%d",30-tot); inoutfile.close(); getch(); break; case 3: //To purchase a movie dvd delitem; int flag=1; char m_name[30]; gotoxy(2,2); cprintf("Enter movie name you want to purchase:-"); gets(m_name); char c_name[30]; gotoxy(2,4); cprintf("Enter your name:-"); gets(c_name); fstream temp; temp.open("temp.txt",ios::ate|ios::out|ios::binary); inoutfile.open("cd1.txt",ios::binary|ios::in); while(inoutfile) { inoutfile.read((char*)&delitem,sizeof(delitem)); if(strcmp(delitem.getname(),m_name)==0 && !inoutfile.eof()) { if(*(delitem.getqty())>1) { int *qty; flag=0; qty=delitem.getqty(); (*qty)--; temp.write((char*)&delitem,sizeof(delitem)); search(m_name,c_name); gotoxy(4,6); cprintf("Enjoy with your favourite movie"); } else { search(m_name,c_name); gotoxy(4,6); flag=0; cprintf("Enjoy with your favourite movie"); } } else if(strcmp(delitem.getname(),m_name)!=0 && !inoutfile.eof()) { temp.write((char*)&delitem,sizeof(delitem)); } }//end of while if(flag) { customer cust; int f=0; custfile.open("customer.txt",ios::binary|ios::in); while(custfile) { custfile.read((char*)&cust,sizeof(cust)); if(strcmp(cust.getname(),m_name)==0&&!custfile.eof()) f++; } custfile.close(); if(f<=10) { cust.getdata(m_name,c_name); custfile.open("customer.txt",ios::app|ios::out|ios::binary); custfile.write((char*)&cust,sizeof(cust)); gotoxy(2,6); textcolor(15|128); cprintf("Sorry,Movie is not available in shop"); gotoxy(2,7); cprintf("You are in waiting list And your no.is %d",f+1); textcolor(15); } else { gotoxy(2,6); cprintf("Waiting list is full");//If there are 10 //waitings for a particular title } custfile.close(); } temp.flush(); inoutfile.flush(); temp.close(); inoutfile.close(); remove("cd1.txt"); rename("temp.txt","cd1.txt"); getch(); break; case 4: customer cust1; char name[30],mname[30]; int pos,endpos; custfile.open("customer.txt",ios::binary|ios::out|ios::in); custfile.seekg(0,ios::end); endpos=custfile.tellg(); pos=endpos/sizeof(customer); int i=0,c=0; fstream temp1; temp1.open("temp1.txt",ios::binary|ios::out|ios::ate); custfile.seekg(0); custfile.read((char*)&cust1,sizeof(cust1)); strcpy(name,cust1.getname()); while(i<=pos-1) { custfile.seekg(c*sizeof(cust1)); c++; while(custfile) { custfile.read((char*)&cust1,sizeof(cust1)); if(strcmp(cust1.getname(),name)==0&&!custfile.eof()) { temp1.write((char*)&cust1,sizeof(cust1)); i++; } } custfile.close(); custfile.open("customer.txt",ios::binary|ios::in); custfile.seekg(c*sizeof(cust1)); while(custfile) { custfile.read((char*)&cust1,sizeof(cust1)); strcpy(mname,cust1.getname()); if(strcmp(name,mname)==0) { c++; } else { strcpy(name,cust1.getname()); custfile.close(); custfile.open("customer.txt",ios::binary|ios::in); break; } } } temp1.flush(); custfile.flush(); temp1.close(); custfile.close(); remove("customer.txt"); rename("temp1.txt","customer.txt"); gotoxy(1,4); textcolor(15|128); cprintf(" Your records are updated"); getch(); break; case 5: customer list; int y1,records=0; custfile.open("customer.txt",ios::in|ios::binary); gotoxy(1,0); for( l=0;l<=40;l++) cprintf("-"); gotoxy(2,2); cprintf("MOVIE NAME"); gotoxy(22,2); cprintf("CUSTOMER NAME"); gotoxy(1,3); for( l=0;l<=40;l++) cprintf("-"); y1=4; while(custfile) { custfile.read((char*)&list,sizeof(list)); if(!custfile.eof()) { list.showdata(y1++); records++; } if(records==7) { textcolor(12|128); delay(1000); cprintf(" %10s Press any key to see more records..."); textcolor(15); getch(); records=0; clrscr(); gotoxy(1,0); for( l=0;l<=40;l++) cprintf("-"); gotoxy(2,2); cprintf("MOVIE NAME"); gotoxy(22,2); cprintf("CUSTOMER NAME"); gotoxy(1,3); for( l=0;l<=40;l++) cprintf("-"); y1=4; } } custfile.close(); getch(); break; case 6: clrscr(); int gdriver = DETECT, gmode; initgraph(&gdriver, &gmode, "\turboc3\bgi"); setfillstyle(LINE_FILL,DARKGRAY); settextstyle(TRIPLEX_FONT,HORIZ_DIR,4); outtextxy(5,2,"Exiting......"); for(int k=0;k<=630;k++) { bar(100,80,k,450); delay(10);} settextstyle(SMALL_FONT,HORIZ_DIR,7); outtextxy(2,85,"Programmed by : Sumit Sood "); setcolor(LIGHTGREEN); outtextxy(5,110,"Website : www.sumit_sood@.datainfosys.net"); setcolor(LIGHTCYAN); outtextxy(5,150,"Email : sood_sumitl9@rediffmail.com"); outtextxy(5,180,"Email : chejara_lalit@rediffmail.com"); setcolor(LIGHTMAGENTA); settextstyle(TRIPLEX_FONT,HORIZ_DIR,3); outtextxy(5,400,"Have a nice day !!!"); delay(5000); closegraph(); exit(1); } }while(n!=6); getch(); } void pass_scr() { char pass[20],correctpassword[20]="sumit"; cleardevice(); setcolor(WHITE); setfillstyle(SOLID_FILL,BLUE); settextstyle(TRIPLEX_FONT,HORIZ_DIR,4); bar(10,0,600,65); outtextxy(89,2," WELCOME IN MUSIC SHOP "); rectangle(88,50,530,45); setcolor(WHITE); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); setfillstyle(SOLID_FILL,BLUE); bar(100,80,530,450); outtextxy(103,85,"Enter password : "); outtextxy(100,200,"This Project illustrate:-"); outtextxy(100,215," 1. Maintain the list of all movies in shop"); outtextxy(100,230," 2. Maintain the waiting list"); outtextxy(100,245," 3. List of sold out movies"); outtextxy(100,260," 3. Facilitate to add new movies"); outtextxy(125,400,"E-mail:-sood_sumit19@rediffmail.com"); outtextxy(125,430,"E-mail:-chejara_lalit@rediffmail.com"); outtextxy(10,470,"Your trial password is:- sumit"); int a=-1,c=230; while (pass[a]!=' ') { pass[++a]=getche(); if (pass[a]==' ' || a>=6){ pass[a]='

Related Source Codes

Script Name Author
Moving ball screen saver karlmarx
The Classic Game of Snake & Ladder Lakshmi Narayana .A
Railway seat reservation question which comes in sapient VyomWorld
To calculate percentile Ravi Mathur
Send to folder ANIMESH SAHU
Analog clock and calendar Nazia & Rida
HIGH/LOW GAME MOLLY ARORA
Data structure (stack Implimentation) Swapnil B Adsure
Memory Game AnirudhSanyal
Easy Calc Anirudh Sanyal
GK Quiz Anirudh Sanyal
Hangman Game Manish Jain
Snakeman Manish Jain
Full month Calendar Nigi
Cursor shapes nigi

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions | Important Websites
Copyright ©2003-2024 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=499


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review