Beruflich Dokumente
Kultur Dokumente
UNIVERSITY
TERM PAPER
CSE-101
Gas Agency
Management
System
Submitted to:
Submitted by:
Roll.No.- 40
Reg.No- 10801210
Class- bca-mca
ACKNOWLEDGEMENT
INTRODUCTION
C programming helps us in finding the solution of the problems by the
computer language, by preparing the C program codes. As same in this
program of the address book we have given a statement in the
execution screen to enter the address of the employee or any personal
address. In this program I used structures and if-else loops with the
help of switch case and for loops.
Advantages:--
There are many advantages of this system whose name is Gas
Agency management System This system is use in many
Government System without of this system no one can use gas
cylinders in their home… as we all know that gas is very important in
our homes withouts of this no one can eat food….
System Requirements:--
management system
We can make this gas management system in C language by using three or
more than three header files or many data types such as:
there are many header files which are used in this program….
many more…..
function such as :
a. Strrev();
b. Strlen();
c. Strupr();
d. Strlwr();
Source code
#include <stdio.h> //Header file included to use funcitons like fseek,fopen etc.
#include <conio.h> //Header file for using functions like getch, cprintf etc.
void getinput(float *x); //Checks the input for all Decimal values entered
while input
void getprh(int *p); //Checks the input of interger type for Fuel types
void getld(unsigned long *p); //Checks the length and validity of input of type
long (Receipt Number)
int day;
int mon;
int year;
float sum_rate;
float quantity;
int fuel;
y;
} z;
{ window(1,1,80,25);
textbackground(WHITE); clrscr();
window(5,3,75,17); textbackground(BLACK);
clrscr();
window(7,4,73,16); textbackground(WHITE);
textcolor(4); clrscr();
gotoxy(2,1);
gotoxy(2,2);
getch();
window(1,1,80,25);
textbackground(15);
{ rate1();
rate2();
rate3();
}
start();
} //End of main
void start()
{ do
{ window(1,1,80,25);
textbackground(WHITE); clrscr();
window(5,3,75,17); textbackground(BLACK);
clrscr();
window(7,4,73,16); textbackground(WHITE);
textcolor(4); clrscr();
gotoxy(2,1);
gotoxy(2,2);
printf(" ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
±±±±±±±±±±±±±±±±±±±±±±±±±±±\n");
printf("\t ² ²\n");
printf("\t ²±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
±±±±±±±±±±±±±±±±±±±±±±±±±±²\n");
getint(&i);
window(1,1,80,25);
textbackground(15);
if(i>7||i==0)
{ war_func(); /*Calling Fucntion to show
Warning*/
clrscr();
else if(i==5)
else if(i==3)
else if(i==4)
else if(i==1)
else if(i==6)
{ main();
} else if(i==2)
clrscr();
printf("\tLanguage : C\n");
printf("\n\n\n\t\tEXITING IN 3 SECONDS...");
delay(3500);
return 0;
{ clrscr();
window(5,3,75,17);
textbackground(BLACK);
window(7,4,73,16);
textbackground(WHITE);
textcolor(4);
clrscr();
getch();
clrscr();
{ FILE *fp;
screen();
fp=fopen("Bills.rec","rb+");
getld(&car_id1);
if((car_id1==y.car_id)&&(y.car_id!=0))
{ shows();
do
fflush(stdin);
ch=toupper(getch());
} while(ch!='Y'&& ch!='N');
if(ch=='Y')
{ empty();
fseek(fp,ftell(fp)-sizeof(y),0);
fwrite(&y,sizeof(y),1,fp);
clrscr();
getch();
window(1,1,80,25);
textbackground(WHITE);
clrscr();
fclose(fp); }
else if (ch=='N')
{ fclose(fp);
window(1,1,80,25);
textbackground(WHITE);
clrscr();
start();
} } else
getch();
window(1,1,80,25);
textbackground(WHITE);
clrscr();
fclose(fp);
void view()
{ FILE *fp;
clrscr();
fp=fopen("Bills.rec","rb");
while(fread(&y,sizeof(y),1,fp)!=NULL)
{
if((y.day!=0)&&(y.car_id!=0))
do
{ screen();
gotoxy(2,4);printf(" ");
shows();
ch=toupper(getch());
} while(ch!='Y'&& ch!='N');
if(ch=='N ')
{ fclose(fp);
enter_view();
} } }
fclose(fp);
void modify()
{ FILE *fp;
clrscr();
window(4,4,74,12);
textbackground(BLACK);
clrscr();
window(5,5,73,11);
textbackground(WHITE);
clrscr();
fp=fopen("Bills.rec","rb+");
getld( &car_id1 );
{ shows();
do
{ gotoxy(2,7);
fflush(stdin);
ch=toupper(getch());
} while(ch!='Y'&& ch!='N');
if(ch=='Y')
window(1,1,80,25); clrscr();
textbackground(WHITE); clrscr();
window(5,3,75,17); textbackground(BLACK);
clrscr();
window(7,4,73,16); textbackground(WHITE);
textcolor(4); clrscr();
gotoxy(1,2);
printf("°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°");
getdate(&d);
y.day = d.da_day;
y.mon = d.da_mon;
y.year= d.da_year;
gotoxy(1,4);
printf("°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
");
do
{ gotoxy(3,5);
} while(y.quantity==0);
getprh(&y.fuel);
gotoxy(2,8);printf(" ");
switch(y.fuel)
{ case 1:
rate=z.ch1;
break;
case 2:
rate=z.ch2;
break;
case 3:
gotoxy(20,7); printf("CNG");
rate=z.ch3;
} y.sum_rate=rate*y.quantity;
gotoxy(1,8);
printf("-------------------------------------------------------------------");
gotoxy(1,11); printf("±±±±±±±±±±±±±±±±±±±±±
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±");
fseek(fp,ftell(fp)-sizeof(y),0);
fwrite(&y,sizeof(y),1,fp);
fclose(fp);
getch();
window(1,1,80,25);
textbackground(WHITE);
else if (ch=='N');
{ fclose(fp);
window(1,1,80,25);
textbackground(WHITE);
start();
}} else
getch();
window(1,1,80,25);
textbackground(WHITE);
clrscr();
FILE *fp;
screen();
fp=fopen("Bills.rec","rb");
gotoxy(2,2);
getld(&car_id1);
if((car_id1==y.car_id)&&(y.car_id!=0))
{ shows();
getch();
window(1,1,80,25);
textbackground(WHITE);
}
else
getch();
window(1,1,80,25);
textbackground(WHITE);
clrscr();
fclose(fp);
clrscr();
textbackground(WHITE);
clrscr();
window(5,3,75,17);
textbackground(BLACK);
clrscr();
window(7,4,73,16);
textbackground(WHITE);
textcolor(4);
clrscr();
gotoxy(1,2);
printf("°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°");
do{ gotoxy(3,3);
printf(" ");
getld(&temp);
} while(duplicate(temp));
y.car_id = temp;
getdate(&d);
y.day = d.da_day;
y.mon = d.da_mon;
y.year= d.da_year;
gotoxy(1,4);
printf("°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°");
do
getinp ut(&y.quantity);
} while(y.quantity==0);
getprh(&y.fuel);
gotoxy(2,8);
printf(" ");
switch(y.fuel)
CASE 1:
rate=z.ch1;
break;
CASE 2:
rate=z.ch2;
break;
CASE 3:
gotoxy(20,7); printf("CNG");
rate=z.ch3;
break;
DEFAULT:
gotoxy(20,7);war_func();
break;
} y.sum_rate=rate*y.quantity;
gotoxy(1,8); printf("-------------------------------------------------------------------");
gotoxy(1,10); printf("±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±");
void input
FILE *fp;
char ch;
do {
fp=fopen("Bills.rec","ab");
add();
fwrite(&y,sizeof(y),1,fp);
fclose(fp);
ch=toupper(getch());
} while (ch=='Y')
void rate1()
{ screen();
getinput(&z.ch1);
} void rate2()
getinput(&z.ch2);
}
void rate3()
getinput(&z.ch3);
window(1,1,80,25);
textbackground(WHITE);
clrscr();
char x[MAX];
int n=0;
do
Do { ch=getch();
if(((ch>='0'&&ch<='9')||(ch=='.')) &&(n<MAX))
{ x[n]=ch;
n++;
printf("%c",ch);
else if(ch==8&&n>0)
printf("%c%c%c",8,32,8);
n--;
x[n]='\0';
*y=atof(x);
} while(ch!=13);
{ char x[MAX];
int n=0;
do{
do{
ch=getch();
if(((ch>='1'&&ch<='7')||(ch=='.')) &&(n<MAX-4))
x[n]=ch;
n++;
printf("%c",ch);
else if(ch==8&&n>0)
{ printf("%c%c%c",8,32,8);
n--; }
} while(ch!=13&&n<MAX);
x[n]='\0';
*u=atoi(x);
} while(ch!=13);
{ char x[MAX];
int n=0;
do{
do{ ch=toupper(getch());
{ x[n]=ch;
n++;
printf("%c",ch);
} else
if(ch==8&&n>0)
{ printf("%c%c%c",8,32,8);
n--;
}} while(ch!=13&&n<MAX);
x[n]='\0';
*p=atoi(x);
} while(ch!=13);
char x[MAX];
int n=0;
do{
do{
ch=toupper(getch());
{ x[n]=ch;
n++;
printf("%c",ch);
else
if(ch==8&&n>0)
{ printf("%c%c%c",8,32,8);
n--; }
} while(ch!=13&&n<MAX);
x[n]='\0';
*p=atol(x);
}while(ch!=13);
void empty()
{ y.car_id=0;
y.fuel=0;
y.day=0;
y.mon=0;
y.year=0;
y.sum_rate=0;
y.quantity=0;
} void enter_view()
{ int u;
screen();
getint(&u);
if(u==1)
view();
if(u==2)
{ window(1,1,80,25);
textbackground(WHITE);
clrscr();
start();
FILE *fp;
fp=fopen("Bills.rec","rb");
fclose(fp);
if((rno == y.car_id)||(rno==0))
return 1;
else
return 0;
void shows()
{
gotoxy(41,1); printf("²±±±±±±±±±±±±±±±±±±±±
±±±±±±±±");
if(y.fuel==1)
else if(y.fuel==2)
else
gotoxy(41,7); printf("²±±±±±±±±±±±±±±±±±±±±
±±±±±±±±");
void screen()
window(1,1,80,25);
textbackground(WHITE);
clrscr();
window(4,4,74,12);
textbackground(BLACK);
clrscr();
window(5,5,73,11);
textcolor(4);
textbackground(WHITE);
clrscr();