0% found this document useful (0 votes)
2 views

Program

The document is a C++ program that facilitates the opening and management of a bank account. It collects user details such as name, age, gender, and account type, and allows for operations like withdrawing and adding money, checking balance, and deactivating the account. The program includes various input validations and account number generation based on the user's name initials.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Program

The document is a C++ program that facilitates the opening and management of a bank account. It collects user details such as name, age, gender, and account type, and allows for operations like withdrawing and adding money, checking balance, and deactivating the account. The program includes various input validations and account number generation based on the user's name initials.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 9

#include <iostream>

//#include <conio.h>
//#include <dos.h>
using namespace std;

int main() {
//clrscr();
char ac_fname[30],gender[6],ac_type;
int wmoney,admoney, opt,a,b,c,d,ac_no = 0,ac_bal,age,dac_no, chac_no;

cout<<"Enter Your Details For Open New Bank Account \n\n";


cout<<"\nEnter Your Name : ";
cin.getline(ac_fname, 29);
cout<<"\nEnter your Age : ";
cin>>age;
cout<<"\nEnter Gender : ";
cin>>gender;
cout<<"\nWhich Account S/C : ";
cin>>ac_type;

cout<<"~~~~~~~~~~~~~~~~~~~~~~~\n";
cout<<"\n\n\n";
if(age >= 18) {
if(ac_type == 'S' || ac_type == 's' || ac_type == 'C' || ac_type == 'c'){
switch (ac_fname[0]){
case 'A':
case 'a':
case 'B':
case 'b':
case 'C':
case 'c':
case 'D':
case 'd':
case 'E':
case 'e':
{ a = 3;
break; }

case 'F':
case 'f':
case 'G':
case 'g':
case 'H':
case 'h':
case 'I':
case 'i':
case 'J':
case 'j':
{ a = 4;
break; }
case 'K':
case 'k':
case 'L':
case 'l':
case 'M':
case 'm':
case 'N':
case 'n':
case 'O':
case 'o':
{ a = 5;
break; }
case 'P':
case 'p':
case 'Q':
case 'q':
case 'R':
case 'r':
case 's':
case 'S':
case 'T':
case 't':
{ a = 6;
break; }
case 'U':
case 'u':
case 'V':
case 'v':
case 'W':
case 'w':
case 'X':
case 'x':
case 'Y':
case 'y':
{ a = 8;
break; }
case 'Z':
case 'z':
{ a = 7;
break; }
default: a = 1;
}

switch (ac_fname[1]){
case 'A':
case 'a':
case 'B':
case 'b':
case 'C':
case 'c':
case 'D':
case 'd':
case 'E':
case 'e':
{ b = 6;
break; }
case 'F':
case 'f':
case 'G':
case 'g':
case 'H':
case 'h':
case 'I':
case 'i':
case 'J':
case 'j':
{ b = 2;
break; }
case 'K':
case 'k':
case 'L':
case 'l':
case 'M':
case 'm':
case 'N':
case 'n':
case 'O':
case 'o':
{ b = 9;
break; }
case 'P':
case 'p':
case 'Q':
case 'q':
case 'R':
case 'r':
case 's':
case 'S':
case 'T':
case 't':
{ b = 5;
break; }
case 'U':
case 'u':
case 'V':
case 'v':
case 'W':
case 'w':
case 'X':
case 'x':
case 'Y':
case 'y':
{ b = 3;
break; }
case 'Z':
case 'z':
{ cout<<"7";
break; }
default: b = 1;
}
switch (ac_fname[2]){
case 'A':
case 'a':
case 'B':
case 'b':
case 'C':
case 'c':
case 'D':
case 'd':
case 'E':
case 'e':
{ c = 8;
break; }

case 'F':
case 'f':
case 'G':
case 'g':
case 'H':
case 'h':
case 'I':
case 'i':
case 'J':
case 'j':
{ c = 1;
break; }
case 'K':
case 'k':
case 'L':
case 'l':
case 'M':
case 'm':
case 'N':
case 'n':
case 'O':
case 'o':
{ c = 6;
break; }
case 'P':
case 'p':
case 'Q':
case 'q':
case 'R':
case 'r':
case 's':
case 'S':
case 'T':
case 't':
{ c = 3;
break; }
case 'U':
case 'u':
case 'V':
case 'v':
case 'W':
case 'w':
case 'X':
case 'x':
case 'Y':
case 'y':
{ c = 9;
break; }
case 'Z':
case 'z':
{ cout<<"7";
break; }
default: c = 1;
}
switch (ac_fname[3]){
case 'A':
case 'a':
case 'B':
case 'b':
case 'C':
case 'c':
case 'D':
case 'd':
case 'E':
case 'e':
{ d = 3;
break; }

case 'F':
case 'f':
case 'G':
case 'g':
case 'H':
case 'h':
case 'I':
case 'i':
case 'J':
case 'j':
{
d = 0;
break; }
case 'K':
case 'k':
case 'L':
case 'l':
case 'M':
case 'm':
case 'N':
case 'n':
case 'O':
case 'o':
{ d = 5;
break; }
case 'P':
case 'p':
case 'Q':
case 'q':
case 'R':
case 'r':
case 's':
case 'S':
case 'T':
case 't':
{ d = 7;
break; }
case 'U':
case 'u':
case 'V':
case 'v':
case 'W':
case 'w':
case 'X':
case 'x':
case 'Y':
case 'y':
{ d = 2;
break; }
case 'Z':
case 'z':
{ cout<<"7";
break; }
default: d = 1;
}
ac_no = ac_no + a;
ac_no = ac_no * 10;
ac_no = ac_no + b;
ac_no = ac_no * 10;
ac_no = ac_no + c;
ac_no = ac_no * 10;
ac_no = ac_no +d;
cout<<"\nAdd money To your new account : ";
cin>>ac_bal;
cout<<"\n\n_____________________\n";
cout<<"\nAccount Holder name = "<<ac_fname<<" ";
cout<<"\nAccount Number = "<<ac_no;
cout<<"\nAccount Balance = "<<ac_bal;
cout<<"\nGender = "<<gender;

if(ac_type == 's' || ac_type == 'S')


{
cout<<"\nSaving Account";
}
else if(ac_type == 'c' || ac_type == 'C')
{
cout<<"\nCurrent Account";
}
else cout<<"\nAccount type not specified@";
//Start loop here
do{
for(int i=0;i<=79;i++){cout<<"-";}
cout<<"\n\n Choose Option \n\n";
cout<<"1. Withdraw Money ";
cout<<"\n2. Add Money ";
cout<<"\n3. Deactivate Account ";
cout<<"\n4. Check Bank Balance ";
cout<<"\n5. Exit\n";
cin>>opt;
switch(opt){
case 1: {
cout<<"\nWithdraw Money: ";
cin>>wmoney;
if (wmoney <= ac_bal){
ac_bal = ac_bal - wmoney;
cout<<"\nAmount Withdrawal successful ";
}
else cout<<"\n Insufficient Balance ";
break;}
case 2:{
cout<<"\n Add Money to your account: ";
cin>>admoney;
ac_bal = ac_bal + admoney;
break; }
case 3: {
cout<<"Please Share Your Account Number: ";
cin>>dac_no;
if(dac_no == ac_no){
cout<<"Account Successfully Deactivated!";
}
else cout<<"Account Number Not Match";
break;}
case 4:{
cout<<" Enter Account Number : \n";
cin>>chac_no;
if(ac_no == chac_no){
cout<<"\n\n_____________________\n";
cout<<"\nAccount Holder name = "<<ac_fname<<" ";
cout<<"\nAccount Number = "<<a<<b<<c<<d;
cout<<"\nAccount Balance = "<<ac_bal;
cout<<"\nGender = "<<gender;

if(ac_type == 's' || ac_type == 'S')


{
cout<<"\nSaving Account";
}
else if(ac_type == 'c' || ac_type == 'C')
{
cout<<"\nCurrent Account";
}
else cout<<"Account type not specified@";
cout<<"\n\n_____________________\n";
}
else cout<<" Invalid Account Number "; break;
}
case 5: {
for(int i=0;i<=79;i++)
{
cout<<"#";
}
cout<<"\n";
// delay(500);
cout<<"Exiting";
//delay(500);
cout<<".";
//delay(500);
cout<<".";
//delay(500);
cout<<".";
//delay(500);
exit (0);
}
default: cout<<"Invalid Choice";
}
}while(opt!=5);
/*
cout<<"\n\n Choose Option \n\n";
cout<<"1. Withdraw Money ";
cout<<"\n2. Add Money ";
cout<<"\n3. Deactivate Account ";
cout<<"\n4. Check Bank Balance\n ";
cin>>opt;

switch(opt){
case 1: {
cout<<"\nWithdraw Money: ";
cin>>wmoney;
if (wmoney <= ac_bal){
ac_bal = ac_bal - wmoney;
cout<<"\nAmount Withdrawal successful ";
}
else cout<<"\n ~Insufficient Balance~ ";
break;}
case 2:{
cout<<"\n Add Money to your account: ";
cin>>admoney;
ac_bal = ac_bal + admoney;
cout<<"\n Account Balance Update Successfully ";
break;
}

case 3: {
cout<<"Please Share Your Account Number: ";
cin>>dac_no;
if(dac_no == ac_no){
cout<<"Account Successfully Deactivated!";
}
else cout<<"Account Number Not Match";
break;}

case 4:{
cout<<" Enter Account Number : \n";
cin>>chac_no;
if(ac_no == chac_no){

cout<<"\nAccount Holder name = "<<ac_fname<<" ";


cout<<"\nAccount Number = "<<a<<b<<c<<d;
cout<<"\nAccount Balance = "<<ac_bal;
cout<<"\nGender = "<<gender;

if(ac_type == 's' || ac_type == 'S')


{
cout<<"\nSaving Account";
}
else if(ac_type == 'c' || ac_type == 'C')
{
cout<<"\nCurrent Account";
}
else cout<<"Account type not specified@";
cout<<"\n\n_____________________\n";
} else cout<<" Invalid Account Number ";
break;
}
default: cout<<"Invalid Choice";

}
*/

}
else cout<<"~Please Choose Account type between S/C !";
}
else
cout<<"~For opening account your Age should Be 18+ ! ";

return 0;
}
}

You might also like