0% found this document useful (0 votes)
11 views3 pages

C Project Bank

برنامج البنك بلغة c++
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

C Project Bank

برنامج البنك بلغة c++
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

#include <iostream>

#include<string>
using namespace std;

class Bank {

string Name[50], Address[50];


int id[50];
double Ball[50];

public:

void createAcount(int ,int ,string ,string,double );


void ShowDetieAcount(int , int );
void AddBalanse(int, int, double);
void WithoutBalanse(int, int, double);
void ListAllAcount(int);
};
void Bank::createAcount(int Lentharry, int idNumber, string name, string
address,double balan) {
id[Lentharry] = idNumber;
Name[Lentharry] = name;
Address[Lentharry] = address;
Ball[Lentharry] = balan;
cout << "\n" << "Id: " << id[Lentharry] << "\nName: " << Name[Lentharry]
<< "\nAdress: " << Address[Lentharry] << "\nBalances: " << Ball[Lentharry] <<
endl;
}
void Bank::ShowDetieAcount(int LenthArray, int idd) {

for (int i = 0; i < LenthArray; i++)


if (id[i] == idd) {
cout << "\n" << "Id: " << id[i] << "\nName: " << Name[i] <<
"\nAdress: " << Address[i] << "\nBalances: " << Ball[i] << endl;

}
else {}
}
void Bank::AddBalanse(int Lentharry, int idd, double BalanseAdd) {
for (int i = 0; i < Lentharry; i++) {
if (id[i] == idd) {
Ball[i] += BalanseAdd;
cout << "\n" << "Id: " << id[i] << "\nName: " << Name[i] <<
"\nAdress: " << Address[i] << "\nBalances: " << Ball[i] << endl;
break;
}
}

void Bank::WithoutBalanse(int Lentharry, int idd, double BalanseAdd) {


for (int i = 0; i < Lentharry; i++) {
if (id[i] == idd) {
if (BalanseAdd <= Ball[i]) {
Ball[i] -= BalanseAdd;
cout << "\n" << "Id: " << id[i] << "\nName: " <<
Name[i] << "\nAdress: " << Address[i] << "\nBalances: " << Ball[i] << endl;
break;
}
else { cout << "Cant Without Becouse your balance then
without" << endl; }

}
}

void Bank::ListAllAcount(int Lentharry) {


for(int i=0;i< Lentharry;i++)
cout << "\n" << "Id: " << id[i] << "\nName: " << Name[i] << "\nAdress: "
<< Address[i] << "\nBalances: " << Ball[i] << endl;
}

int main()
{
int choice=0;
string name, address;
int IndexArray=0,id;
double Balans;
Bank customer;
while (choice != -1) {
cout << "----------------------------------------------------" <<
endl;
cout << "1. Create Account" << endl;
cout << "2 .to show your current account details" << endl;
cout << "3. Add Balance" << endl;
cout << "4. Without BALANCE " << endl;
cout << "5.List All Account" << endl;
cout << "plase choise 1-5 for Exit press -1" << endl;
cin >> choice;

switch (choice)
{
case 1:
cout << "please enter ID: ";
cin >> id;
cout << "Please Enter Name: ";
cin >> name;
cout << "please Enter Address: ";
cin >> address;
cout << "please Enter Balance: ";
cin >> Balans;

customer.createAcount(IndexArray, id, name, address,


Balans);
IndexArray++;
break;
case 2:
cout << "Enter ID Account: ";
cin >> id;
customer.ShowDetieAcount(IndexArray, id);
break;
case 3:
cout << "Enter ID Account: ";
cin >> id;
cout << "Enter Balance Add: ";
cin >> Balans;
customer.AddBalanse(IndexArray, id, Balans);
break;
case 4:
cout << "Enter ID Account: ";
cin >> id;
cout << "Enter Balance Without: ";
cin >> Balans;
customer.WithoutBalanse(IndexArray, id, Balans);
break;
case 5:
customer.ListAllAcount(IndexArray);

break;
default:
choice = -1;
cout << "Good BYE Anas izzat Abu Dayah" << endl;
break;
}

}
return 0;
}

You might also like