SlideShare a Scribd company logo
/* C project on a bookshop for saving of coustmer record*/
//header files
#include<stdio.h> //standard library input output
#include<conio.h> //console input output
#include<string.h> //
#include<stdlib.h>
void write()
{
/* file pointer create */
FILE *fp;
//define arry
char dat[20];
char un[20];
char bn[20];
char mn[20];
int cost; //define an integer
printf("nPlease Enter the Date: ");
scanf("%s",&dat);
printf("nPlease Write a Costumer Name: ");
scanf("%s",&un);
printf("nPlease Write a Book Name: ");
scanf("%s",&bn);
printf("nPlease Write a Mobile Number: ");
scanf("%s",&mn);
printf("nPlease Write a Cost of a Book: ");
scanf("%d",&cost); //
/*save record in txt file*/
fp=fopen("Record.txt","a");
fprintf(fp,"%s %s %s %s %dn",dat,un,bn,mn,cost);
printf("n Record Written Successfully!!!");
fclose(fp); //closing the pointer
getch();//get character//
}
/*display function start*/
void display()
{
char date[20]; //char define
char uname[20];
char mnumber[20];
char bname[20];
int bcost; //integer define
/*for comparing*/
char dat[20];
char cname[20];
char number[20];
char book[20];
int com;
/*file pointer*/
FILE *fp;
fp=fopen("record.txt","r");
int res; //res is using for comparing
printf("Enter your choice to search the Recordnn");
printf("xDBxDBxDBxDBxB2 1. By datenn"); /* xDB is used for some designing*/
printf("xDBxDBxDBxDBxB2 2. By Coustmer namenn");
printf("xDBxDBxDBxDBxB2 3. By Mobile numbernn");
printf("xDBxDBxDBxDBxB2 4. By book namenn");
scanf("%d",&com);
system("cls");//for clear the screen
if(com==1){
printf("Please enter daten");
scanf("%s",&dat);
while (fscanf(fp,"%s %s %s %s %d",date,uname,bname,mnumber,&bcost)!=EOF)
{
res=strcmp(date,dat); //string comparing
if(res==0){
printf("nDate: %s", date);
printf("nCoustmer name is: %s",uname);
printf("nMobile number is: %s",mnumber);
printf("nBook name is: %s",bname);
printf("nBook cost is: %d",bcost);
fclose(fp); //file pointer close
}
}
}
if(com==2){
printf("Please enter a namen");
scanf("%s",&cname);
while (fscanf(fp,"%s %s %s %s %d",date,uname,bname,mnumber,&bcost)!=EOF){
res=strcmp(uname,cname); //string comparing
if(res==0){
printf("nDate: %s", date);
printf("nCoustmer name is: %s",uname);
printf("nMobile number is: %s",mnumber);
printf("nBook name is: %s",bname);
printf("nBook cost is: %d",bcost);
}
}
fclose(fp); //file pointer close
}
if(com==3){
printf("Please enter a mobile numbern");
scanf("%s",&number);
while (fscanf(fp,"%s %s %s %s %d",date,uname,bname,mnumber,&bcost)!=EOF){
res=strcmp(mnumber,number); //string comparing
if(res==0){
printf("nDate: %s", date);
printf("nCoustmer name is: %s",uname);
printf("nMobile number is: %s",mnumber);
printf("nBook name is: %s",bname);
printf("nBook cost is: %d",bcost);
}
}
fclose(fp); //file pointer close
}
if(com==4){
printf("Please enter a Book namen");
scanf("%s",&book);
while (fscanf(fp,"%s %s %s %s %d",date,uname,bname,mnumber,&bcost)!=EOF){
res=strcmp(bname,book); //string comparing
if(res==0){
printf("nDate: %s", date);
printf("nCoustmer name is: %s",uname);
printf("nMobile number is: %s",mnumber);
printf("nBook name is: %s",bname);
printf("nBook cost is: %d",bcost);
}
}
fclose(fp); // file pointer close
}
if(com==5){
printf("Please enter the book namen");
scanf("%s",&bname);
while (fscanf(fp,"%s %s %s %s %d",date,uname,bname,mnumber,&bcost)!=EOF){
res=strcmp(bname,bname); //string comparing
if(res==0){
printf("nDate: %s", date);
printf("nCoustmer name is: %s",uname);
printf("nMobile number is: %s",mnumber);
printf("nBook name is: %s",bname);
printf("nBook cost is: %d",bcost);
}
}
fclose(fp); //file pointer close
}
getch(); //get character
}
/*closing function*/
void exit(){
printf("THANKSn");
}
/* starting main function*/
int main(void)
{
printf("tttttxB2xB2xB2xB2xB2xB2xB2xB2xB2xB2xB2xB2 Welcome to the
Bookshop xB2xB2xB2xB2xB2xB2xB2xB2xB2xB2xB2xB2nnnn");
printf("ttttt xB2xB2xB2xB2xB2xB2 This is main menu
xB2xB2xB2xB2xB2xB2n");
/* xB2 and xDB used for designing*/
int c; //integer define
char e[20]; //array define
/*do while loop*/
do {
printf("nnxDBxDBxDBxDBxB2 Press 1 for Costumer entry. nn");
printf("xDBxDBxDBxDBxB2 Press 2 for for Books Record. nn");
printf("xDBxDBxDBxDBxB2 Press 0 for Close Application. nn");
printf("Enter Your Choice...n");
scanf("%d",&c);
system("cls"); //clear screen
/*switch statement*/
switch(c){
case 1:write();
break;
case 2:
display();
break;
case 0:
exit();
break;
}
}
while(c!=0);
getch(); //get character
return 0;
}

More Related Content

DOCX
C programs
PDF
Git avançado
PDF
Scroll pHAT HD に美咲フォント
PPTX
Computer programing w
DOCX
Tugas Program C++
PDF
PDF
PDF
Ooprc3c
C programs
Git avançado
Scroll pHAT HD に美咲フォント
Computer programing w
Tugas Program C++
Ooprc3c

What's hot (15)

ODP
Parsec
PPT
6 pointers functions
DOCX
One dimensional operation of Array in C- language
DOCX
Project filter matlab
PDF
Groovify your java code by hervé roussel
PDF
C-- Sample Programs and Screenshots
PPTX
การเข ยนคำส _งควบค_มข__นพ__นฐาน (1)
PPTX
เธเธฒเธฃเน€เธ‚ เธขเธ™เธ„เธณเธช _เธ‡เธ„เธงเธšเธ„_เธกเธ‚__เธ™เธž__เธ™เธเธฒเธ™
PDF
JavaSE7 Launch Event: Java7xGroovy
DOCX
timingExercise
PDF
Coding with Vim
RTF
Class & sub class
RTF
PDF
Unit 1 ocs752 introduction to c programming
TXT
Parsec
6 pointers functions
One dimensional operation of Array in C- language
Project filter matlab
Groovify your java code by hervé roussel
C-- Sample Programs and Screenshots
การเข ยนคำส _งควบค_มข__นพ__นฐาน (1)
เธเธฒเธฃเน€เธ‚ เธขเธ™เธ„เธณเธช _เธ‡เธ„เธงเธšเธ„_เธกเธ‚__เธ™เธž__เธ™เธเธฒเธ™
JavaSE7 Launch Event: Java7xGroovy
timingExercise
Coding with Vim
Class & sub class
Unit 1 ocs752 introduction to c programming
Ad

Similar to C project on a bookshop for saving of coustmer record (20)

DOCX
#include stdio.h#include stdlib.h#include string.ht.docx
DOC
Library Management System in c++
DOCX
Data structures
PDF
C programming Create a system managing a mini library system. Eve.pdf
DOC
Ticket window & automation system
PDF
C programs Set 4
DOC
Project report
DOCX
A c program of Phonebook application
TXT
c++ project on restaurant billing
PPTX
LIBRARY MANAGEMENT SYSTEM ppt.pptx
DOC
Project hotel on hotel management fo
PPT
File handling in c
DOCX
Library Managment System - C++ Program
PPT
Mesics lecture files in 'c'
DOCX
#include stdio.h#include stdlib.htypedef FILE stream.docx
PPTX
Input output functions
ODT
Library Management Project (computer science) class 12
PDF
Computer Investgatort Project (HOTEL MANAGEMENT SYSTEM)
PPT
file handling1
PDF
Im posting this again because the answer wasnt correct.Please .pdf
#include stdio.h#include stdlib.h#include string.ht.docx
Library Management System in c++
Data structures
C programming Create a system managing a mini library system. Eve.pdf
Ticket window & automation system
C programs Set 4
Project report
A c program of Phonebook application
c++ project on restaurant billing
LIBRARY MANAGEMENT SYSTEM ppt.pptx
Project hotel on hotel management fo
File handling in c
Library Managment System - C++ Program
Mesics lecture files in 'c'
#include stdio.h#include stdlib.htypedef FILE stream.docx
Input output functions
Library Management Project (computer science) class 12
Computer Investgatort Project (HOTEL MANAGEMENT SYSTEM)
file handling1
Im posting this again because the answer wasnt correct.Please .pdf
Ad

More from Zaibi Gondal (10)

PPTX
Modal Verbs
DOCX
Parts of speech1
PPTX
Wirless Security By Zohaib Zeeshan
PPTX
Backup data
DOCX
Programming fundamentals
DOCX
C programming Lab 2
DOCX
C programming Lab 1
DOCX
Functional english
DOCX
application of electronics in computer
PPTX
Model Verbs
Modal Verbs
Parts of speech1
Wirless Security By Zohaib Zeeshan
Backup data
Programming fundamentals
C programming Lab 2
C programming Lab 1
Functional english
application of electronics in computer
Model Verbs

Recently uploaded (20)

PPTX
Cell Types and Its function , kingdom of life
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
Complications of Minimal Access Surgery at WLH
PPTX
master seminar digital applications in india
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
Updated Idioms and Phrasal Verbs in English subject
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
A systematic review of self-coping strategies used by university students to ...
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
01-Introduction-to-Information-Management.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
Cell Types and Its function , kingdom of life
Chinmaya Tiranga quiz Grand Finale.pdf
Complications of Minimal Access Surgery at WLH
master seminar digital applications in india
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Final Presentation General Medicine 03-08-2024.pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Final Presentation General Medicine 03-08-2024.pptx
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Microbial diseases, their pathogenesis and prophylaxis
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Updated Idioms and Phrasal Verbs in English subject
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
A systematic review of self-coping strategies used by university students to ...
History, Philosophy and sociology of education (1).pptx
01-Introduction-to-Information-Management.pdf
Microbial disease of the cardiovascular and lymphatic systems

C project on a bookshop for saving of coustmer record

  • 1. /* C project on a bookshop for saving of coustmer record*/ //header files #include<stdio.h> //standard library input output #include<conio.h> //console input output #include<string.h> // #include<stdlib.h> void write() { /* file pointer create */ FILE *fp; //define arry char dat[20]; char un[20]; char bn[20]; char mn[20]; int cost; //define an integer printf("nPlease Enter the Date: "); scanf("%s",&dat); printf("nPlease Write a Costumer Name: "); scanf("%s",&un); printf("nPlease Write a Book Name: "); scanf("%s",&bn); printf("nPlease Write a Mobile Number: "); scanf("%s",&mn); printf("nPlease Write a Cost of a Book: "); scanf("%d",&cost); // /*save record in txt file*/
  • 2. fp=fopen("Record.txt","a"); fprintf(fp,"%s %s %s %s %dn",dat,un,bn,mn,cost); printf("n Record Written Successfully!!!"); fclose(fp); //closing the pointer getch();//get character// } /*display function start*/ void display() { char date[20]; //char define char uname[20]; char mnumber[20]; char bname[20]; int bcost; //integer define /*for comparing*/ char dat[20]; char cname[20]; char number[20]; char book[20]; int com; /*file pointer*/ FILE *fp; fp=fopen("record.txt","r"); int res; //res is using for comparing printf("Enter your choice to search the Recordnn"); printf("xDBxDBxDBxDBxB2 1. By datenn"); /* xDB is used for some designing*/
  • 3. printf("xDBxDBxDBxDBxB2 2. By Coustmer namenn"); printf("xDBxDBxDBxDBxB2 3. By Mobile numbernn"); printf("xDBxDBxDBxDBxB2 4. By book namenn"); scanf("%d",&com); system("cls");//for clear the screen if(com==1){ printf("Please enter daten"); scanf("%s",&dat); while (fscanf(fp,"%s %s %s %s %d",date,uname,bname,mnumber,&bcost)!=EOF) { res=strcmp(date,dat); //string comparing if(res==0){ printf("nDate: %s", date); printf("nCoustmer name is: %s",uname); printf("nMobile number is: %s",mnumber); printf("nBook name is: %s",bname); printf("nBook cost is: %d",bcost); fclose(fp); //file pointer close } } } if(com==2){ printf("Please enter a namen"); scanf("%s",&cname);
  • 4. while (fscanf(fp,"%s %s %s %s %d",date,uname,bname,mnumber,&bcost)!=EOF){ res=strcmp(uname,cname); //string comparing if(res==0){ printf("nDate: %s", date); printf("nCoustmer name is: %s",uname); printf("nMobile number is: %s",mnumber); printf("nBook name is: %s",bname); printf("nBook cost is: %d",bcost); } } fclose(fp); //file pointer close } if(com==3){ printf("Please enter a mobile numbern"); scanf("%s",&number); while (fscanf(fp,"%s %s %s %s %d",date,uname,bname,mnumber,&bcost)!=EOF){ res=strcmp(mnumber,number); //string comparing if(res==0){ printf("nDate: %s", date); printf("nCoustmer name is: %s",uname); printf("nMobile number is: %s",mnumber); printf("nBook name is: %s",bname); printf("nBook cost is: %d",bcost); } }
  • 5. fclose(fp); //file pointer close } if(com==4){ printf("Please enter a Book namen"); scanf("%s",&book); while (fscanf(fp,"%s %s %s %s %d",date,uname,bname,mnumber,&bcost)!=EOF){ res=strcmp(bname,book); //string comparing if(res==0){ printf("nDate: %s", date); printf("nCoustmer name is: %s",uname); printf("nMobile number is: %s",mnumber); printf("nBook name is: %s",bname); printf("nBook cost is: %d",bcost); } } fclose(fp); // file pointer close } if(com==5){ printf("Please enter the book namen"); scanf("%s",&bname); while (fscanf(fp,"%s %s %s %s %d",date,uname,bname,mnumber,&bcost)!=EOF){ res=strcmp(bname,bname); //string comparing if(res==0){ printf("nDate: %s", date);
  • 6. printf("nCoustmer name is: %s",uname); printf("nMobile number is: %s",mnumber); printf("nBook name is: %s",bname); printf("nBook cost is: %d",bcost); } } fclose(fp); //file pointer close } getch(); //get character } /*closing function*/ void exit(){ printf("THANKSn"); } /* starting main function*/ int main(void) {
  • 7. printf("tttttxB2xB2xB2xB2xB2xB2xB2xB2xB2xB2xB2xB2 Welcome to the Bookshop xB2xB2xB2xB2xB2xB2xB2xB2xB2xB2xB2xB2nnnn"); printf("ttttt xB2xB2xB2xB2xB2xB2 This is main menu xB2xB2xB2xB2xB2xB2n"); /* xB2 and xDB used for designing*/ int c; //integer define char e[20]; //array define /*do while loop*/ do { printf("nnxDBxDBxDBxDBxB2 Press 1 for Costumer entry. nn"); printf("xDBxDBxDBxDBxB2 Press 2 for for Books Record. nn"); printf("xDBxDBxDBxDBxB2 Press 0 for Close Application. nn"); printf("Enter Your Choice...n"); scanf("%d",&c); system("cls"); //clear screen /*switch statement*/ switch(c){ case 1:write(); break; case 2: display(); break;