0% found this document useful (0 votes)
0 views4 pages

Project Code June 27

This document is a C program for a simple Bank Management System that includes functionalities for user login, adding customer records, and displaying customer information. It utilizes file handling to store customer data and features a basic menu for user interactions. The program includes functions for welcoming the user, logging in, and managing customer records.

Uploaded by

lokichaulagain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views4 pages

Project Code June 27

This document is a C program for a simple Bank Management System that includes functionalities for user login, adding customer records, and displaying customer information. It utilizes file handling to store customer data and features a basic menu for user interactions. The program includes functions for welcoming the user, logging in, and managing customer records.

Uploaded by

lokichaulagain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

#include<stdio.

h>
#include<conio.h>
#include<string.h>
void welcomescreen();//function declaration
void login();
void mainmenu();
void addcustomer();
char user[20]="KARNA", pass[20]="1234";
struct customer{
char cname[15];
// char baddress[15];
// char cadd[15];
int accno;
float balance;

}c;
FILE *fptr;
void main()
{
fptr=fopen("customer.txt","r+");
if(fptr==NULL)
{
printf("File cannot open");
exit(0);
}
welcomescreen();// function call
login();
// mainmenu();

void welcomescreen() //function definition


{
char ch;
printf("#############################\n");
printf("# Welcome #\n");
printf("# to #\n");
printf("# Bank Management System #\n");
printf("#############################\n");
printf("Enter any key to continue");
ch=getch();
}

void login()
{
char username[20],password[20],ch;
int i;
system("cls");
printf("Enter you id:");
scanf("%s",&username);
printf("Enter your password:");
for(i=0;i<20;i++)
{
ch=getch();
if(ch==13)
{
break;
}
password[i]=ch;
printf("*");
}
password[i]='\0';
if(strcmp(user,username)==0 && strcmp(pass,password)==0)
{
mainmenu();
}
else
{
printf("Id password not matched, press any key to try again");
ch=getch();
login();

void mainmenu()
{ int choice;
char ch;
system("cls");
printf("Menu For Bank Management System\n");
printf("1. Add Customer \n2.Show Customer \n3.Deposit Amount \n4.Withdraw
Amount\n5.Exit");
printf("\nEnter the choice for above:");
scanf("%d",&choice);
switch(choice)
{
case 1:
addcustomer();

break;
case 2:
printf("Name:%s\nAccount No:%d\n
Balance:%f",c.cname,c.accno,c.balance);
break;
case 3:
printf("Add customer");
break;
case 4:
printf("Add customer");
break;
case 5:
exit(0);
default:
printf("\nInvalid choice wish to continue? Y|N");
fflush(stdin);
ch=getchar();
if(ch=='Y')
{
mainmenu();
}
else
{
exit(0);
}

}
}

void addcustomer()
{
system("cls");
printf("Enter record of customer");
printf("\nEnter name of customer");
scanf("%s",&c.cname);
printf("Enter the account number:");
scanf("%d",&c.accno);
printf("Enter the opening balance:");
scanf("%f",&c.balance);
fseek(fptr,0,2); //file ko pointer lai last ma lageko , 0 is offset, 2 indicates
last of file
fwrite(&c,sizeof(c),1,fptr);
printf("Record inserted successfully");
printf("Press any key to continue");
getch();
mainmenu();
}

You might also like