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

Bui 8 Lding

dfghdsgfghxsfghzshgsg

Uploaded by

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

Bui 8 Lding

dfghdsgfghxsfghzshgsg

Uploaded by

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

#include <stdio.

h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>

int main_exit;

void menu();

struct date {
int month, day, year;
};

struct customer {
char name[60];
int acc_no, age;
char address[60];
char citizenship[15];
double phone;
char acc_type[10];
float amt;
struct date dob;
struct date deposit;
struct date withdraw;
} add, upd, check, rem, transaction;

float interest(float t, float amount, int rate) {


return (rate * t * amount) / 100.0;
}

void fordelay(int j) {
for (int i = 0; i < j; i++);
}

void new_acc() {
FILE *ptr = fopen("record.dat", "a+");
if (!ptr) {
perror("Unable to open file!");
return;
}

int account_no;
system("cls");
printf("\t\t\t\xB2\xB2\xB2 ADD RECORD \xB2\xB2\xB2");
printf("\n\nEnter today's date(mm/dd/yyyy):");
scanf("%d/%d/%d", &add.deposit.month, &add.deposit.day, &add.deposit.year);

while (1) {
printf("\nEnter the account number:");
scanf("%d", &account_no);
check.acc_no = account_no;

// Check if account number already exists


int exists = 0;
while (fscanf(ptr, "%d %59s %d/%d/%d %d %59s %14s %lf %9s %f %d/%d/%d",
&add.acc_no, add.name, &add.dob.month, &add.dob.day,
&add.dob.year,
&add.age, add.address, add.citizenship, &add.phone,
add.acc_type,
&add.amt, &add.deposit.month, &add.deposit.day,
&add.deposit.year) != EOF) {
if (check.acc_no == add.acc_no) {
printf("Account no. already in use!\n");
exists = 1;
break;
}
}
fseek(ptr, 0, SEEK_SET); // Reset file pointer to the beginning
if (!exists) break; // If the account does not exist, exit the loop
}

add.acc_no = check.acc_no;
printf("Enter the name: ");
scanf("%59s", add.name);
printf("Enter the date of birth(mm/dd/yyyy): ");
scanf("%d/%d/%d", &add.dob.month, &add.dob.day, &add.dob.year);
printf("Enter the age: ");
scanf("%d", &add.age);
printf("Enter the address: ");
scanf("%59s", add.address);
printf("Enter the citizenship number: ");
scanf("%14s", add.citizenship);
printf("Enter the phone number: ");
scanf("%lf", &add.phone);
printf("Enter the amount to deposit: $");
scanf("%f", &add.amt);

printf("Type of account:\n\t#Saving\n\t#Current\n\t#Fixed1 (1 year)\n\t#Fixed2


(2 years)\n\t#Fixed3 (3 years)\n\nEnter your choice: ");
scanf("%9s", add.acc_type);

fprintf(ptr, "%d %s %d/%d/%d %d %s %s %lf %s %f %d/%d/%d\n",


add.acc_no, add.name, add.dob.month, add.dob.day, add.dob.year,
add.age, add.address, add.citizenship, add.phone,
add.acc_type, add.amt, add.deposit.month, add.deposit.day,
add.deposit.year);

fclose(ptr);
printf("\nAccount created successfully!\n");
printf("\nEnter 1 to go to the main menu and 0 to exit: ");
scanf("%d", &main_exit);
system("cls");
if (main_exit == 1)
menu();
else
exit(0);
}

void view_list() {
FILE *view = fopen("record.dat", "r");
if (!view) {
perror("Unable to open file!");
return;
}

system("cls");
printf("\nACC. NO.\tNAME\t\t\tADDRESS\t\t\tPHONE\n");
int test = 0;
while (fscanf(view, "%d %59s %d/%d/%d %d %59s %14s %lf %9s %f %d/%d/%d",
&add.acc_no, add.name, &add.dob.month, &add.dob.day,
&add.dob.year,
&add.age, add.address, add.citizenship, &add.phone, add.acc_type,
&add.amt, &add.deposit.month, &add.deposit.day,
&add.deposit.year) != EOF) {
printf("\n%6d\t %10s\t\t\t%10s\t\t%.0lf", add.acc_no, add.name,
add.address, add.phone);
test++;
}

fclose(view);
if (test == 0) {
system("cls");
printf("\nNO RECORDS!!\n");
}

printf("\n\nEnter 1 to go to the main menu and 0 to exit: ");


scanf("%d", &main_exit);
system("cls");
if (main_exit == 1)
menu();
else
exit(0);
}

void edit(void) {
// Edit function implementation remains unchanged
}

void transact(void) {
// Transaction function implementation remains unchanged
}

void erase(void) {
// Erase function implementation remains unchanged
}

void see(void) {
// See function implementation remains unchanged
}

void close(void) {
printf("\n\n\n\nThis C Mini Project is developed by Code With C team!\n");
exit(0);
}

void menu(void) {
int choice;
system("cls");
printf("\n\n\t\t\tCUSTOMER ACCOUNT BANKING MANAGEMENT SYSTEM");
printf("\n\n\n\t\t\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2 WELCOME TO THE MAIN MENU \xB2\
xB2\xB2\xB2\xB2\xB2\xB2");
printf("\n\n\t\t1.Create new account\n\t\t2.Update information of existing
account\n\t\t3.For transactions\n\t\t4.Check the details of existing account\n\t\
t5.Removing existing account\n\t\t6.View customer's list\n\t\t7.Exit\n\n\n\n\n\t\t
Enter your choice: ");
scanf("%d", &choice);
system("cls");
switch (choice) {
case 1: new_acc(); break;
case 2: edit(); break;
case 3: transact(); break;
case 4: see(); break;
case 5: erase(); break;
case 6: view_list(); break;
case 7: close(); break;
default: printf("Invalid choice!"); menu(); break;
}
}

int main() {
char pass[10], password[10] = "codewithc";
printf("\n\n\t\tEnter the password to login: ");
scanf("%s", pass);

if (strcmp(pass, password) == 0) {
printf("\n\nPassword Match!\nLOADING");
for (int i = 0; i <= 6; i++) {
fordelay(100000000);
printf(".");
}
system("cls");
menu();
} else {
printf("\n\nWrong password!!\a\a\a");
printf("\nEnter 1 to try again and 0 to exit: ");
scanf("%d", &main_exit);
if (main_exit == 1) {
system("cls");
main();
} else {
system("cls");
close();
}
}
return 0;
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy