CBank/3_Implementation/src/CBank_Header.c
void create_new_account()
{
    int choice;
    FILE *ptr;

    ptr = fopen("CBankRecord.dat", "a+");
account_no:
    system("clear");
    printf("\t\t\t\t\t\t\xB1\xB1\xB1\xB1\xB1\xB1\xB1\xB1 ADD RECORD \xB1\xB1\xB1\xB1\xB1\xB1\xB1\xB1");
    printf("\n\n\n Enter today's date (mm/dd/yyyy) : ");
    scanf("%d/%d/%d", &add.deposit.month, &add.deposit.day, &add.deposit.year);
    printf("\n Enter the account number : ");
    scanf("%d", &check.acc_no);
    while (fscanf(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) != EOF)
    {
        if (check.acc_no == add.acc_no)
        {
            printf(" Account no. already in use ! ");
            compute_delay(1000000000);
            goto account_no;
        }
    }
    add.acc_no = check.acc_no;
    printf("\n Enter the name : ");
    scanf("%s", add.name);
    printf("\n Enter the date of birth (mm/dd/yyyy) : ");
    scanf("%d/%d/%d", &add.dob.month, &add.dob.day, &add.dob.year);
    printf("\n Enter the age : ");
    scanf("%d", &add.age);
    printf("\n Enter the address : ");
    scanf("%s", add.address);
    printf("\n Enter the citizenship number : ");
    scanf("%s", add.citizenship);
    printf("\n Enter the phone number : ");
    scanf("%lf", &add.phone);
    printf("\n Enter the amount to deposit : $");
    scanf("%f", &add.amt);
    printf("\n Type of account : \n\t#Saving\n\t#Current\n\t#Fixed1(for 1 year)\n\t#Fixed2(for 2 years)\n\t#Fixed3(for 3 years)\n\n\t Enter your choice : ");
    scanf("%s", 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("\n Account created successfully ! ");
add_invalid:
    printf("\n\n\n\t\t Enter 1 to go to the main menu and 0 to exit : ");
    scanf("%d", &main_exit);
    system("clear");
    if (main_exit == 1)
        bank_menu();
    else if (main_exit == 0)
        main_screen();
    else
    {
        printf("\n Invalid ! \a");
        goto add_invalid;
    }
}
/**
 * @brief Create a new account object
 * 
 */
@brief Create a new account object
@brief Create a new account object
void create_new_account()
{
    int choice;
    FILE *ptr;
    ptr = fopen("CBankRecord.dat", "a+");
account_no:
    system("clear");
    printf("\t\t\t\t\t\t\xB1\xB1\xB1\xB1\xB1\xB1\xB1\xB1 ADD RECORD \xB1\xB1\xB1\xB1\xB1\xB1\xB1\xB1");
    printf("\n\n\n Enter today's date (mm/dd/yyyy) : ");
    scanf("%d/%d/%d", &add.deposit.month, &add.deposit.day, &add.deposit.year);
    printf("\n Enter the account number : ");
    scanf("%d", &check.acc_no);
    while (fscanf(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) != EOF)
    {
        if (check.acc_no == add.acc_no)
        {
            printf(" Account no. already in use ! ");
            compute_delay(1000000000);
            goto account_no;
        }
    }
    add.acc_no = check.acc_no;
    printf("\n Enter the name : ");
    scanf("%s", add.name);
    printf("\n Enter the date of birth (mm/dd/yyyy) : ");
    scanf("%d/%d/%d", &add.dob.month, &add.dob.day, &add.dob.year);
    printf("\n Enter the age : ");
    scanf("%d", &add.age);
    printf("\n Enter the address : ");
    scanf("%s", add.address);
    printf("\n Enter the citizenship number : ");
    scanf("%s", add.citizenship);
    printf("\n Enter the phone number : ");
    scanf("%lf", &add.phone);
    printf("\n Enter the amount to deposit : $");
    scanf("%f", &add.amt);
    printf("\n Type of account : \n\t#Saving\n\t#Current\n\t#Fixed1(for 1 year)\n\t#Fixed2(for 2 years)\n\t#Fixed3(for 3 years)\n\n\t Enter your choice : ");
    scanf("%s", 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("\n Account created successfully ! ");
add_invalid:
    printf("\n\n\n\t\t Enter 1 to go to the main menu and 0 to exit : ");
    scanf("%d", &main_exit);
    system("clear");
    if (main_exit == 1)
        bank_menu();
    else if (main_exit == 0)
        main_screen();
    else
    {
        printf("\n Invalid ! \a");
        goto add_invalid;
    }
}
void create_new_account ( ) { int choice ; FILE * ptr ; ptr = fopen ( " " , " " ) ; account_no : system ( " " ) ; printf ( " \t \t \t \t \t \t \xB1 \xB1 \xB1 \xB1 \xB1 \xB1 \xB1 \xB1 \xB1 \xB1 \xB1 \xB1 \xB1 \xB1 \xB1 \xB1 " ) ; printf ( " \n \n \n " ) ; scanf ( " " , & add . deposit . month , & add . deposit . day , & add . deposit . year ) ; printf ( " \n " ) ; scanf ( " " , & check . acc_no ) ; while ( fscanf ( ptr , " \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 ) != EOF ) { if ( check . acc_no == add . acc_no ) { printf ( " " ) ; compute_delay ( 1000000000 ) ; goto account_no ; } } add . acc_no = check . acc_no ; printf ( " \n " ) ; scanf ( " " , add . name ) ; printf ( " \n " ) ; scanf ( " " , & add . dob . month , & add . dob . day , & add . dob . year ) ; printf ( " \n " ) ; scanf ( " " , & add . age ) ; printf ( " \n " ) ; scanf ( " " , add . address ) ; printf ( " \n " ) ; scanf ( " " , add . citizenship ) ; printf ( " \n " ) ; scanf ( " " , & add . phone ) ; printf ( " \n " ) ; scanf ( " " , & add . amt ) ; printf ( " \n \n \t \n \t \n \t \n \t \n \t \n \n \t " ) ; scanf ( " " , add . acc_type ) ; fprintf ( ptr , " \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 ( " \n " ) ; add_invalid : printf ( " \n \n \n \t \t " ) ; scanf ( " " , & main_exit ) ; system ( " " ) ; if ( main_exit == 1 ) bank_menu ( ) ; else if ( main_exit == 0 ) main_screen ( ) ; else { printf ( " \n \a " ) ; goto add_invalid ; } }
@brief Create a new account object
@brief Create a new account object