#include<string.h>
#include<stdlib.h>
#include<windows.h>
#include<ctype.h>
#include<time.h>
welcome_board ()
{
time_t t;
time(&t);
int i;
char str[]=”WHERE CUSTOMERS MATTERS”;
printf(“\n\t\t\t\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb CUSTOMER BILL PORTAL \xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb”);
printf(“\n\n\n\t\t\t\t\t”);
for(i=0;i<strlen(str);i++)
{
printf(“%c”, str[i]);
Sleep(150);
}
printf(“\n\t\t\t\t————-WECLOME CUSTOMER————-“);
printf(“\n\t\t\t\t\t%s”,ctime(&t));//printing time by calling time function//
getch();//holds the screen}user_exit()
{
system(“cls”);
printf(“\n\t\t\t\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb HAVE A GOOD DAY DEAR CUSTOMER! \xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb”);
}
// function for creating new accounts for the customer and those who already have can sign in//struct user
{
char username[10];
char password[10];
char phone[10];
}*pUser;void userlogin()
{FILE *fp;
char uName[10], pwd[10], ph[10];
int i,choiceee;
char c;//assigning memory to structure dynmically//
pUser=(struct user *)malloc(sizeof(struct user));printf(“1. Login Through An Existing Account\n2. Create New account\n\n”);
scanf(“%d”,& i);system(“cls”);switch(i){
case 1:
if ( ( fp=fopen(“user.dat”, “r+”)) == NULL) {
if ( ( fp=fopen(“user.dat”, “w+”)) == NULL) {
printf (“Could not open file\n”);
exit ( 1);
}
}
//asking user name and password for signing in//
printf(“Username: “);
scanf(“%9s”,uName);
printf(“Password: “);
scanf(“%9s”,pwd);
printf(“Phone: “);
scanf(“9f”,ph);
//traversing and checking if record exist//
while ( fread (pUser, sizeof(struct user), 1, fp) == 1) {
if( strcmp ( pUser->username, uName) == 0)
{
printf (“Match username\n”);
if( strcmp ( pUser->password, pwd) == 0)
{
printf (“Match password\n”);
if( strcmp ( pUser->phone, ph) == 0)
{
printf(“Match Number\n”);
printf(“login successfully!”);
printf(“\t\t\tSYSTEM IS LOADING…”);
for(i=0;i<6;i++)
{
printf(“.”);
Sleep(500);
}
printf(“Press 1 to pay bill or 2 to display your record: “);
scanf(“%d”, &choiceee);
getch();
system(“cls”);
if(choiceee==1)
{
store_bill();
}
if(choiceee==2)
{
show_bill();
}
}
else
{
printf(“wrong attempt!”);
userlogin();
}
}
}
break;
case 2:
do
{
//opening file//
if ( ( fp=fopen(“user.dat”, “a+”)) == NULL) {
if ( ( fp=fopen(“user.dat”, “w+”)) == NULL) {
printf (“Could not open file\n”);
exit ( 1);
}
}
printf(“Choose A Username: “);
scanf(“%9s”,pUser->username);
printf(“Choose A Password: “);
scanf(“%9s”,pUser->password);
printf(“Enter Your phone “);
scanf(“%9s”,pUser->phone);
system(“cls”);
fwrite (pUser, sizeof(struct user), 1, fp);
printf(“\nAdd another account? (Y/N): “);
scanf(” %c”,&c); //skip leading whitespace
}while(c==’Y’||c==’y’);
printf(“Press 1 to pay bill or 2 to display your record: “);
scanf(“%d”, &choiceee);
getch();
system(“cls”);
if(choiceee==1)
{
store_bill();
}
if(choiceee==2)
{
show_bill();
}
break;
}
free ( pUser); //free allocated memory
fclose(fp);
}
}struct bill
{
char name[100];
char date[100];
float amount;
float units;
int regno;
}c,b;void store_bill()
{char c;
float a;
FILE *fp;if ( ( fp=fopen(“bill.dat”, “r+”)) == NULL) {
if ( ( fp=fopen(“bill.dat”, “w+”)) == NULL) {
printf (“Could not open file\n”);
exit ( 1);
}
}
//asking all necessary information to add in employes file//
printf(“\nEnter your name please: “);
fflush(stdin);
gets(b.name);
printf(“\nEnter date today(month/year): “);
fflush(stdin);
gets(b.date);
printf(“\nEnter no of units used :”);
scanf(“%f”, &b.units);
b.amount=b.units*2.87;
printf(“\nEnter your regno: “);
scanf(“%d”, &b.regno);
fprintf(fp,”%s %s %f %d\n”,b.name,b.date,b.amount,b.regno);
printf(“YOUR BILL RECORD SUCCESSFULLY ADDED “);
fclose(fp);
getch();
system(“cls”);
user_exit();
}void show_bill()
{
int flag=1;
FILE *ptr;
ptr=fopen(“bill.dat”, “a+”);
{
if(ptr==NULL)
{
printf(“something went wrong :”);
userlogin();
}
}printf(“\nEnter the date of the bill you paid and your Regno:”);
fflush(stdin);
gets(c.date);
fflush(stdin);
scanf(“%d”, &c.regno);
system(“cls”);
printf(“\n\n”);
while(fscanf(ptr,”%s %s %f %d\n”,b.name,b.date,&b.amount,&b.regno)!=EOF)
{
if(c.date==b.name && c.regno==b.regno)
{
printf(“\n”);
flag=1;
printf(“\tMONTH = %s “, b.date );
printf(“\t\tAMOUNT OF BILL = %f “, b.amount);}
else
{
if(flag==0)
{
printf(“No Record Found!!!”);
}
}}
fclose(ptr);
system(“cls”);
user_exit();}int main()
{
welcome_board();
system(“cls”);
userlogin();return 0;
}
Learn Railway Reservation Project in C (CLICK)
This is the 1st Output Screen of Our Bussiness Project. Where we shaw Customer Bill Portal with a Respective message and Current Time and Date. of Management and Billing System Project in C
Press any Key for Continue…After That…
Restaurant Customer billing system project in C
Here two Optionof Management and Billing System Project in C for you:-
2. Create New Account
Actually, the 1st Option showing you your Account information, If you are a new customer in this portal then you need to choose the 2nd Option for creating your Account.
Choose A Username: Thesmolt
Choose A Password: Hi97
Enter Your phone 12345
C program for login and password
After Creating a new account in Management and Billing System Project in C, If You Press any key…
(You got the same option again for creating an Account)
if you Press N:-
Press 1 to pay the bill or 2 to display your record:
Store management system project in C
After Pressing the 1st option for paying the bill then you need to Enter your Username, Current Time and Date, Ammount of used Unit with your Registration No. After fill this in Management and Billing System Project in C, you got an Option like this:-
Enter date today(month/year): 2/21
Enter no of units used:5
Enter your Regno: 12345
YOUR BILL RECORD SUCCESSFULLY ADDED