Вы находитесь на странице: 1из 21

Lovely Professional University

TERM PAPER Of FOUNDATION OF COMPUTING Topic: -PARKING record system


Submitted To: mr. AMAN KAMBOJ Submitted By:Name:-AMRITPAL KAUR Roll No:-rk3108b48 Section:-k3108

Regd No:-11106941

ACKNOWLEDGEMENT
It is not until you undertake the project like this one that you realize how massive the effort it really is, or how much you must rely upon the Selfless efforts and goodwill of others. There are many who helped us with this project, and we want to thank them all from the core of our Hearts. We owe special words of thanks to our Teachers Mr.AMAN KAMBOJ for their vision, thoughtful counseling and encouragement at every step of the project. We are also thankful to the teachers of the Department for giving us the best of knowledge and guidance throughout the project. And last but not the least, we find no words to acknowledge the financial assistance & moral support rendered by our parents in making the effort a success. All this has become reality because of their blessings and above all by the grace of god.

OVERVIEW TO C HISTORY OF C:
C is a popular general purpose programming language. It is one of the most popular computer languages today, because it is a structured, high level, machine independent language. The root of all modern language is ALGOL, introduced in early 1960s. ALGOL was the 1st computer language to use a block structure. Subsequently, several other languages were announced after 1960s. In 1967, Martin Richard developed a language called BCPL i.e. basic combined programming language mainly for writing system software. In 1970, Ken Thompson created a language using many features of BCPL and called it simply B. B was used to create early version of UNIX operating system. C was evolved from ALGOL, BCPL, and B by Dennis Ritchie at the Bell Laboratories in 1972, strongly associated with UNIX. During 1970s, C had evolved into the TRADITIONAL C. With the publication of the book The C Programming language by Brian Kernighan and Dennis Ritchie in 1978, it becomes more powerful. In 1983, American National Standards Institutes (ANSI) appointed a technical committee to define a standard for C. The committee approved a version of C in December 1989, which is now known as ANSI C. It was then approved by International Standard Organization (ISO) in 1990.

IMPORTANCE OF C:
The increasing popularity of C is probably due to its many desirable qualities. The C compiler combines the capabilities of an

assembly language with the features of a high level language and therefore it is well suited for writing both system software and business packages. In fact many of the C compilers available in the market are written in C. Programs written in C are efficient and fast. This is due to its variety of data types and powerful operators. It is many times faster than BASIC. There are only 32 key words in ANSI C and its strength lies in its built in functions. C is highly portable; this means that C programs written for one computer can be run on another with little or no modifications. C language is well suited for structured programming, thus requiring the user to think of a problem in terms of function modules or blocks. This modular structure makes program de-bugging, testing and maintenance easier. Another important feature of C is its ability to extend itself. We can continuously add our own functions to C library, thus our programming task becomes so easier and simple.

SOURCE CODE
#include<stdio.h> #include<conio.h> #include<stdlib.h> struct date { int day; int month; int year; }d;

struct time { int hour; int min; }t; struct veh { int vno; struct time t; }n; void main() { int nt,i,j,z,choice,ticket,eno=0,enoi=0,lo,lf=219,tam,am,tm,lp=0,lm=0; char *level; FILE *v,*w,*p,*q,*a,*o,*l,*m,*s; q=fopen("occ","w"); fclose(q); l=fopen("occ2","w"); fclose(l); clrscr(); printf("\t\tEnter todays date : month : year : (with a space)"); scanf("%d %d %d",&d.day,&d.month,&d.year); p=fopen("vacant1","wb"); for(j=1;j<=30;j++) { putw(j,p);

} fclose(p); v=fopen("vacant","wb"); for(j=1;j<=40;j++) { putw(j,v); } fclose(v); label : clrscr(); clabel: for(lo=5;lo<=30;lo++) { delay(15); gotoxy(lo,2); printf("*"); } printf(" WELCOME "); for(lo=40;lo<=70;lo++) { delay(5); gotoxy(lo,2); printf("*"); } printf("\n\n\n\n\t\t\t\t1-Entry control\n\n\n\t\t\t\t2-Exit control\n\n\n\t\t\t\t3-exit the program"); printf("\n\n\n\t\t\t\tEnter your choice");

scanf("%d",&choice); switch(choice) { case 1 :clrscr(); for(lo=5;lo<=30;lo++) { delay(15); gotoxy(lo,2); printf("*"); } printf(" WELCOME TO ENTRY CONTROL "); for(lo=58;lo<=70;lo++) { delay(5); gotoxy(lo,2); printf("*"); } printf("\n\n\t\t\t\tEnter your choice\n\n\t\t\t1-Two wheeler\n\n\t\t\t2-four wheeler : "); scanf("%d",&z); switch(z) { case 1 :lp++; eno++; level="L 1"; if(eno==10) {

printf("\a\n\n\t\t\t\tSORRY THE PARKING IS FULL"); } else { printf("The vacant space in the area : \n\n"); v=fopen("vacant","rb"); while(!feof(v)) { j=getw(v); if(j==EOF) break; printf("%d\t",j);

} fclose(v); printf("\n\n\t\t\tEnter the details of the vehicle "); printf("\n\n\n\n\t\t\tEnter the ticket number from above : "); scanf("%d",&ticket); printf("\n\t\t\tEnter the vehicle number : "); scanf("%d",&n.vno); printf("\n\t\t\tEnter the time :HOUR : MINUTES: "); scanf("%d\t%d",&n.t.hour,&n.t.min); q=fopen("occ","ab"); v=fopen("vacant","rb"); w=fopen("revacant","wb"); while(!feof(v))

{ j=getw(v); if(j==EOF) break; else { if(j!=ticket) { putw(j,w); } } } fclose(v); fclose(w); q=fopen("occ","ab"); putw(ticket,q); fclose(q); v=fopen("vacant","wb"); w=fopen("revacant","rb"); while(!feof(w)) { j=getw(w); if(j==EOF) break; else putw(j,v);

} fclose(w); fclose(v); clrscr(); gotoxy(30,10); printf("Loading"); gotoxy(30,11); printf("Printing Please Wait....."); gotoxy(30,12); for(lo=0;lo<=19;lo++) { delay(100); printf("%c",lf); } clrscr(); printf("\n\n\t\t\t\tVehicle number : %d",n.vno); printf("\n\n\t\t\t\tTicket number : %d",ticket); printf("\n\n\t\t\t\tTime %d : %d ",n.t.hour,n.t.min); printf("\n\n\t\t\t\tDate %d / %d / %d",d.day,d.month,d.year); printf("\n\n\t\t\t\tLevel alloted - %s",level); printf("\n\n\n\t\t\t\tThanks !! Visit Again."); sleep(2); clrscr(); printf("\n\n\nWAIT TO EXIT TO MENU"); sleep(3); goto label;

} break; case 2 :lm++; enoi++; level="L 2"; if(enoi==30) { printf("\n\n\t\t\t\t\aSORRY THE PARKING IS FULL"); } else { printf("\nThe vacant spaces are :\n\n"); p=fopen("vacant1","rb"); while((j=getw(p))!=EOF) { printf("%d\t",j);

} fclose(p); printf("\n\n\t\t\tEnter the ticket number "); scanf("%d",&ticket); printf("\n\t\t\tEnter the vehicle number : "); scanf("%d",&n.vno); printf("\n\t\t\tEnter the time :HOUR : MINUTES: "); scanf("%d\t%d",&n.t.hour,&n.t.min); p=fopen("vacant1","rb");

o=fopen("revacant1","wb"); while(!feof(p)) { j=getw(p); if(j==EOF) break; else { if(j!=ticket) putw(j,o); } } fclose(p); fclose(o); l=fopen("occ2","ab"); putw(ticket,l); fclose(l); p=fopen("vacant1","wb"); o=fopen("revacant1","rb"); while(!feof(o)) { j=getw(o); if(j==EOF) break; else putw(j,p);

} fclose(p); fclose(o); clrscr(); gotoxy(30,10); printf("Loading"); gotoxy(30,11); printf("Printing Please Wait....."); gotoxy(30,12); for(lo=0;lo<=19;lo++) { delay(100);

printf("%c",lf); } clrscr(); printf("\n\n\t\t\t\tVehicle number : %d",n.vno); printf("\n\n\t\t\t\tTicket number : %d",ticket); printf("\n\n\t\t\t\tTime %d : %d ",n.t.hour,n.t.min); printf("\n\n\t\t\t\tDate %d / %d / %d",d.day,d.month,d.year); printf("\n\n\t\t\t\tLevel - %s",level); printf("\n\n\n\t\t\t\tThanks !! Visit Again."); sleep(3); clrscr(); printf("\n\n\nWAIT TO EXIT TO MENU"); sleep(3);

goto label; } break; default :printf("\n\n\n\t\t\t\tWRONG KEYWORD EXITING TO MAIN MENU "); sleep(2); goto label; } break; case 2 :clrscr(); for(lo=5;lo<=30;lo++) { delay(15); gotoxy(lo,2); printf("*"); } printf(" WELCOME TO EXIT CONTROL "); for(lo=56;lo<=70;lo++) { delay(5); gotoxy(lo,2); printf("*"); } printf("\n\n\t\t\tEnter your choice\n\n\t\t\t1-two wheeler\n\n\t\t\t2-four wheeler : "); scanf("%d",&z); switch(z)

{ case 1 : eno--; printf("\t\t\t\nLevel 1 is alloted to the vehicle" ); blabel : printf("\n\n\t\t\tPlease take 20 rupees from the customer"); printf("\n\t\t\tEnter the amount given by user"); scanf("%d",&am); if(am<20) { printf("\t\tPlease give total of Rs. 20"); sleep(2); clrscr(); goto blabel; } else { tam=(am-20); printf("Return Rs %d to the customer ",tam); sleep(2); } clrscr(); printf("\n\nThe occupied spaces are : "); q=fopen("occ","rb"); while(!feof(q)) { j=getw(q);

if(j==EOF) break; printf("%d\t",j); } fclose(q); printf("\n\t\t\tEnter the ticket number :"); scanf("%d",&ticket); v=fopen("vacant","ab"); putw(ticket,v); fclose(v); a=fopen("occ1","w"); q=fopen("occ","rb"); while(!feof(q)) { j=getw(q); if(j==EOF) break; else { if(j!=ticket) putw(j,a); } } fclose(a); fclose(q); a=fopen("occ1","rb");

q=fopen("occ","w"); while(!feof(a)) { j=getw(a); if(j==EOF); break; putw(j,q); } fclose(a); fclose(q); goto label; break; case 2 : enoi--; printf("\n\n\t\t\nLevel 2 is alloted to the vehicle" ); alabel : printf("\n\t\t\tPlease take 40 rupees from the customer"); printf("\n\n\\t\tEnter the amount given by user"); scanf("%d",&am); if(am<40) { printf("\n\n\t\tPlease give total of Rs. 40"); sleep(2); clrscr(); goto alabel; } else {

tam=(am-40); printf("\n\n\t\tReturn Rs %d to the customer",tam); sleep(2); } clrscr(); l=fopen("occ2","rb"); printf("\n\nThe occupied spaces are : "); while(!feof(l)) { j=getw(l); if(j==EOF) break; printf("%d\t",j); } fclose(l); printf("\n\n\nEnter the ticket number :"); scanf("%d",&ticket); p=fopen("vacant1","ab"); putw(ticket,p); fclose(p); m=fopen("occ3","w"); l=fopen("occ2","rb"); while(!feof(l)) { j=getw(l); if(j==EOF)

break; else { if(j!=ticket) putw(j,m); } } fclose(l); fclose(m); m=fopen("occ3","rb"); l=fopen("occ2","ab"); while(!feof(m)) { j=getw(m); if(j==EOF); break; putw(j,l); } fclose(m); fclose(l); goto label;

break; default : gotoxy(20,20); printf("PLEASE ENTER A VALID OPTION"); sleep(2);

goto clabel; } break; case 3 :printf("\n\n\t\t\tToadys total two wheeler are : %d",lp); printf("\n\n\t\t\tTodays total four wheelers are : %d ",lm); tm=((20*lp)+(40*lm)); printf("\n\n\t\t\tTodays total income is %d",tm); sleep(5); clrscr();

printf("\n\n************************************************************************** ******"); printf("\n\n\t\t\tPARKING MANAGEMENT SYSTEM"); printf("\n\n\n\n\n\t\t\tPROGRAMER ----> Amritpal kaur"); printf("\n\n\t\t\tSECTION ----> k3108"); printf("\n\n\t\t\tROLL NO. ----> rk3108b48");

printf("\n\n\n\n********************************************************************** **********"); sleep(4); exit(0); break; default :clrscr(); gotoxy(15,15); printf("PLEASE ENTER A VALID OPTION"); sleep(2); goto clabel;

} getch(); }

Вам также может понравиться