0% found this document useful (0 votes)
4 views5 pages

Quiz

The document contains a C++ program that implements a simple bank account management system. It allows users to deposit money, withdraw funds, and check their current balance by entering their account number and PIN. The program runs in a loop until the user chooses to exit, providing a basic interface for banking operations.

Uploaded by

christian.daga10
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)
4 views5 pages

Quiz

The document contains a C++ program that implements a simple bank account management system. It allows users to deposit money, withdraw funds, and check their current balance by entering their account number and PIN. The program runs in a loop until the user chooses to exit, providing a basic interface for banking operations.

Uploaded by

christian.daga10
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/ 5

#include <iostream>

using namespace std;

class BankAccount

public:

int acctnum, pin;

double currbal;

// data shown on outside

bool deposit()

int acctnum1, money;

char again;

system("cls");

cout<<"Enter Account Number: ";

cin >> acctnum1;

cout<<"Enter Amount: ";

cin >> money;

if(acctnum1 == acctnum)

currbal += money;

system("cls");

cout<<"Deposit Successful!\n";

else

{
cout<<"Account Number doesn't exist!";

cin>>again;

system("cls");

if(again == 'N')

return false;

return true;

// put all data or info

void withdraw()

int acctnum1, money, pin1;

system("cls");

cout<<"Enter account number: ";

cin >> acctnum1;

cout<<"Enter pin: ";

cin >> pin1;

cout<<"Enter amount: ";

cin>>money;

// log in part

if(acctnum1 == acctnum && pin1==pin)

system("cls");

currbal -= money;
}

else

system("cls");

void disbal()

int acctnum1, pin1;

system("cls");

cout<<"Enter account number: ";

cin >> acctnum1;

cout<<"Enter pin: ";

cin >> pin1;

if(acctnum1 == acctnum && pin1==pin)

system("cls");

cout<<"Current Balance is: $"<<currbal<<"\n\n";

// log in [part of the code

int disacc()

return acctnum;

}
};

int main()

BankAccount acct1;

bool condi = true;

int choice;

acct1.acctnum = 10;

acct1.pin = 2005;

acct1.currbal = 100000;

while(condi)

// data that the code will usa and show privately

cout<<"Bank System\n1. deposit\n2. withdraw"

<< "\n3. display current balance\n"

<<"4. exit\n\nEnter choice: ";

cin>>choice;

if(choice== 1)

condi = acct1.deposit();

else if(choice == 2)

acct1.withdraw();

else if(choice==3)

acct1.disbal();
}

else if(choice==4)

condi = false;

// processing part of unit if what choice to chooose

return 0;

ss

You might also like