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

Home » C Home » File Operations Home » Car Showroom Database system (Project)

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

Search Projects & Source Codes:

Title Car Showroom Database system (Project)
Author Bilal Ahmad
Author Email the_fair_guy_2002 [at] yahoo.com
Description This programe is basically a database in graphics and file operations are used in it.
Category C » File Operations
Hits 16885
Code Select and Copy the Code
#include<graphics.h> #include<stdio.h> #include<conio.h> #include<stdlib.h> #include<string.h> void owner_entry(void); void owner_read(long); void car_entry(void); void car_read(void); long customer_entry(void); void customer_read(void); void car_match(int); void customer_match(long); void my_logo(void); void main(void) { int choice;char ch[1];int i=2,flag=1; long demand; int gd=DETECT ,gm; initgraph(&gd,&gm,"c:\tc\bgi"); my_logo(); setbkcolor(1); A: cleardevice(); setfillstyle(i,9); floodfill(1,1,1); settextstyle(5,0,4); outtextxy(0,0,"?????????????????????????????"); outtextxy(0,30,"???????????????MAIN MENU??????????????"); outtextxy(0,60,"?????????????????????????????"); outtextxy(0,90,"1. New Owner Entry with his car specification."); outtextxy(0,120,"2. New Customer Entry."); outtextxy(0,150,"3. View all available cars."); outtextxy(0,180,"4. View all customers."); outtextxy(0,210,"5. Exit."); outtextxy(0,240,"?????????????????????????????"); outtextxy(0,270,"Enter your choice(1-5) : "); outtextxy(0,300,"?????????????????????????????"); ch[0]=getch(); ch[1]='<=2 || i>=11) flag*=-1; if(choice>5) { outtextxy(0,330,"Wrong choice."); outtextxy(0,360,"Enter your choice again."); outtextxy(0,390,"------Press any key------"); getch(); goto A; } else switch(choice) { case 1: { owner_entry(); goto A; } case 2: { demand=customer_entry(); owner_read(demand); goto A; } case 3: { car_read(); goto A; } case 4: { customer_read(); goto A; } case 5: goto B; } closegraph(); B: } void owner_entry(void) { struct { int owner_id;long demand; char name[40],address[40],Email_id[40],phone_no[40],mobile[40]; } owner; FILE*fptr; int flag=0,l,i; cleardevice(); setfillstyle(10,9); floodfill(1,1,1); gotoxy(1,1); fptr=fopen("owner.txt","ab"); printf("Enter specifications for owner: "); printf("ID : "); scanf("%d",&owner.owner_id); fflush(stdin); printf("Name : "); gets(owner.name); printf("Address : "); gets(owner.address); A: printf("E-mail ID : "); gets(owner.Email_id); l=strlen(owner.Email_id); for(i=0;i<l;i++) if(owner.Email_id[i]=='@') flag=1; if(flag!=1) { printf("E-mail id should include @ sign. Enter again... "); goto A; } B: printf("Phone No. : "); gets(owner.phone_no); l=strlen(owner.phone_no); if(l!=7) { printf("Enter again...(7-Digits) "); goto B; } C: printf("Mobile No.: "); gets(owner.mobile); l=strlen(owner.mobile); if(l!=11) { printf("Enter again...(11-Digits) "); goto C; } printf("Demand : "); scanf("%ld",&owner.demand); fwrite(&owner,sizeof(owner),1,fptr); fclose(fptr); car_entry(); customer_match(owner.demand); } void owner_read(long demand) { struct { int owner_id;long demand; char name[40],address[40],Email_id[40],phone_no[40],mobile[40]; } owner; FILE*fptr; int number=1,record_no=0; cleardevice(); setfillstyle(10,9); floodfill(1,1,1); gotoxy(1,1); fptr=fopen("owner.txt","rb"); printf(" ?????????????????????????????????????????????????????????????"); printf(" The demand of this customer matches the following"); printf("owner/owners listed with thier car specification.(Press any key)"); printf(" ??????????????????????????????????????????????????????????? "); getch(); while(fread(&owner,sizeof(owner),1,fptr)==1) { if(demand==owner.demand) { printf("???????????? "); printf("Number %d : ",number); printf("???????????? "); printf("ID : %d ",owner.owner_id); printf("Name : %s ",owner.name); printf("Address : %s ",owner.address); printf("E-mail ID : %s ",owner.Email_id); printf("Phone No. : %s ",owner.phone_no); printf("Mobile No.: %s ",owner.mobile); printf("Demand : %ld ",owner.demand); car_match(record_no); printf(" ---Press any key for next record--- "); getch(); cleardevice(); setfillstyle(10,9); floodfill(1,1,1); gotoxy(1,1); number++; } record_no++; } fclose(fptr); printf(" ???????????????????????????????????????????????????????"); printf(" The demand of this customer matches %d owner/owners.",number-1); printf(" ?????????????????????????????????????????????????????????"); fclose(fptr); getch(); } void car_entry(void) { struct { char car_no[40], engine_no[40], chassis_no[40], type[40], colour[40], price[40], model[40]; } car; FILE*fptr; int l; cleardevice(); setfillstyle(10,9); floodfill(1,1,1); gotoxy(1,1); fptr=fopen("car.txt","ab"); printf("Enter specifications for his car: "); fflush(stdin); A: printf("Car No. : "); gets(car.car_no); l=strlen(car.car_no); if(l!=7) { printf("Enter again...(3-letters+4-Digits) "); goto A; } B: printf("Engine no : "); gets(car.engine_no); l=strlen(car.engine_no); if(l!=12) { printf("Enter again...(12-Digits) "); goto B; } C: printf("Chasiss no : "); gets(car.chassis_no); l=strlen(car.chassis_no); if(l!=12) { printf("Enter again...(12-Digits) "); goto C; } printf("Company Name : "); gets(car.type); printf("Colour : "); gets(car.colour); printf("Price : "); gets(car.price); printf("Model : "); gets(car.model); fwrite(&car,sizeof(car),1,fptr); fclose(fptr); } void car_read(void) { struct { char car_no[40], engine_no[40], chassis_no[40], type[40], colour[40], price[40], model[40]; } car; FILE*fptr; int number=1; cleardevice(); setfillstyle(10,9); floodfill(1,1,1); gotoxy(1,1); printf("????????????????????????????????????????????????????? "); fptr=fopen("car.txt","rb"); while(fread(&car,sizeof(car),1,fptr)==1) { printf("???????????? "); printf("Number %d : ",number); printf("???????????? "); printf("Car No. : %s ",car.car_no); printf("Engine no : %s ",car.engine_no); printf("Chasiss no : %s ",car.chassis_no); printf("Company Name : %s ",car.type); printf("Colour : %s ",car.colour); printf("Price : %s ",car.price); printf("Model : %s ",car.model); if(number%2==0) { printf(" ---Press any key for next record--- "); getch(); cleardevice(); setfillstyle(10,9); floodfill(1,1,1); gotoxy(1,1); } number++; } fclose(fptr); printf(" ??????????????????????????????????????????????????????????"); printf(" You have total number of %d cars available now.",number-1); printf(" ????????????????????????????????????????????????????????????"); getch(); } long customer_entry(void) { struct { int customer_id;long demand; char name[40],address[40],Email_id[40],phone_no[40],mobile[40]; } customer; FILE*fptr; int flag=0,i,l; cleardevice(); setfillstyle(10,9); floodfill(1,1,1); gotoxy(1,1); fptr=fopen("customer.txt","ab"); printf("Enter specifications for customer: "); printf("ID : "); scanf("%d",&customer.customer_id); fflush(stdin); printf("Name : "); gets(customer.name); printf("Address : "); gets(customer.address); A: printf("E-mail ID : "); gets(customer.Email_id); l=strlen(customer.Email_id); for(i=0;i<l;i++) if(customer.Email_id[i]=='@') flag=1; if(flag!=1) { printf("E-mail id should include @ sign. Enter again... "); goto A; } B: printf("Phone No. : "); gets(customer.phone_no); l=strlen(customer.phone_no); if(l!=7) { printf("Enter again...(7-Digits) "); goto B; } C: printf("Mobile No.: "); gets(customer.mobile); l=strlen(customer.mobile); if(l!=11) { printf("Enter again...(11-Digits) "); goto C; } printf("Demand : "); scanf("%ld",&customer.demand); fwrite(&customer,sizeof(customer),1,fptr); fclose(fptr); return(customer.demand); } void customer_read(void) { struct { int customer_id;long demand; char name[40],address[40],Email_id[40],phone_no[40],mobile[40]; } customer; FILE*fptr; int number=1; cleardevice(); setfillstyle(10,9); floodfill(1,1,1); gotoxy(1,1); printf("???????????????????????????????????????????????????????? "); fptr=fopen("customer.txt","rb"); while(fread(&customer,sizeof(customer),1,fptr)==1) { printf("???????????? "); printf("Number %d : ",number); printf("???????????? "); printf("ID : %d ",customer.customer_id); printf("Name : %s ",customer.name); printf("Address : %s ",customer.address); printf("E-mail ID : %s ",customer.Email_id); printf("Phone No. : %s ",customer.phone_no); printf("Mobile No.: %s ",customer.mobile); printf("Demand : %ld ",customer.demand); if(number%2==0) { printf(" ---Press any key for next record--- "); getch(); cleardevice(); setfillstyle(10,9); floodfill(1,1,1); gotoxy(1,1); } number++; } fclose(fptr); printf(" ????????????????????????????????????????????????????????????"); printf(" You have total %d customers now.",number-1); printf(" ??????????????????????????????????????????????????????????????"); getch(); } void car_match(int record_no) { struct { char car_no[40],engine_no[40],chassis_no[40],type[40],colour[40],price[40],mode l[40]; } car; FILE*fptr; long int offset; fptr=fopen("car.txt","rb"); offset=(record_no)*sizeof(car); fseek(fptr,offset,0); fread(&car,sizeof(car),1,fptr); printf("???????????? "); printf("His car."); printf(" ???????????? "); printf("Car No. : %s ",car.car_no); printf("Engine no : %s ",car.engine_no); printf("Chasiss no : %s ",car.chassis_no); printf("Company Name : %s ",car.type); printf("Colour : %s ",car.colour); printf("Price : %s ",car.price); printf("Model : %s ",car.model); fclose(fptr); } void customer_match(long demand) { struct { int customer_id;long demand; char name[40],address[40],Email_id[40],phone_no[40],mobile[40]; } customer; FILE*fptr; int number=1; cleardevice(); setfillstyle(10,9); floodfill(1,1,1); gotoxy(1,1); printf("??????????????????????????????????????????????????????????? "); printf("The following customer/customers meets the demand of this owner : "); printf("???????????????????????????????????????????????????????????? "); fptr=fopen("customer.txt","rb"); while(fread(&customer,sizeof(customer),1,fptr)==1) { if(customer.demand==demand) { printf("???????????? "); printf("Number %d : ",number); printf("???????????? "); printf("ID : %d ",customer.customer_id); printf("Name : %s ",customer.name); printf("Address : %s ",customer.address); printf("E-mail ID : %s ",customer.Email_id); printf("Phone No. : %s ",customer.phone_no); printf("Mobile No.: %s ",customer.mobile); printf("Demand : %ld ",customer.demand); if(number%2==0) { printf(" ---Press any key for next record--- "); getch(); cleardevice(); setfillstyle(10,9); floodfill(1,1,1); gotoxy(1,1); } number++; } } fclose(fptr); cleardevice(); setfillstyle(10,9); floodfill(1,1,1); gotoxy(1,1); printf("???????????????????????????????????????????????????????????? "); printf(" %d customer/customers meets the demand of this owner. ",number-1); printf("???????????????????????????????????????????????????????????? "); getch(); } void my_logo(void) { int n,i; cleardevice(); setfillstyle(2,9); setcolor(14); setbkcolor(1); floodfill(1,1,1); settextstyle(5,0,5); delay(1500); outtextxy(200,150,"Bilal Ahmad"); delay(1500); outtextxy(230,190,"BCS-3"); delay(1500); n=450; for(i=170;i<=450;i++) { circle(i,145,2); circle(n,265,2); n--; delay(10); } delay(1500); n=265; for(i=145;i<=265;i++) { circle(170,i,2); circle(450,n,2); n--; delay(10); } setcolor(1); delay(1500); n=450; for(i=170;i<=450;i++) { circle(i,135,2); circle(n,275,2); n--; delay(10); } delay(1500); n=265; for(i=145;i<=265;i++) { circle(160,i,2); circle(460,n,2); n--; delay(10); } delay(1500); setcolor(14); outtextxy(50,265,"A Data base for a showroom"); delay(1500); settextstyle(1,0,1); outtextxy(200,400,"Press any key to continue..."); getch(); }????????????????????????????????????????????????????????????????????????

Related Source Codes

Script Name Author
The Game Opposite as seen on Nokia 2300 Mobile Manikanta
RECURSIVE BALANCED QUICK SORT ashish
Radix Sort ashish
Change your mouse pointer Ashim
The blinking star Shashank
Data Validation Crylittlebaby
To search a file by giving file type like mp3 or mpeg or doc Prashanth SR
Menus Demonstration B.Chidhambaram
Employee Database Project Using C. Reenku Raman Nayak
Creating a Lexical Analyzer in c fahad bader al-buhairi դ ? ??
Calendar Program Omkar & Devendra
Stop double Process for start in C Cedrik Jurak
Stop double Process for start in C Cedrik Jurak
Time Scheduler Atiq Anwar
A timepass game between atmost two players Rahul Roy

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
Copyright ©2003-2017 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=764


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