Tuesday, April 28, 2020

C++ Challenge #5 Bank Management System Part (3/3) with Source Code (In...





source code here



// Bank Management system

// requirements

// 1) Deposite money

// 2) withdraw money

// 3) balance

// 4) transfer

// 5) program exit



program start here



#include <iostream>

using namespace std;

int totalamount = 500;

int deposite_amount;

int withdraw_amount;

int transfer_amount;

void deposite(){

cout << "Enter the amount you want to deposite" <<endl;

cin >> deposite_amount;

totalamount += deposite_amount;

cout << "payment has been deposite" <<endl;

}

void withdraw(){

cout << "Enter the amount you want to withdraw" <<endl;

cin >> withdraw_amount;

if(withdraw_amount < totalamount){

totalamount -= withdraw_amount;

}else{

cout << "you have less amount"<<endl;

}







cout << "payment has been withdrawn";

}

void balance(){

cout << "total amount " << totalamount <<endl;



}

void transfer(){

cout << "Enter the amount you want to transfer" <<endl;

cin >> transfer_amount;

if(transfer_amount < totalamount){

totalamount -= transfer_amount;

}else{

cout << "you have less amount";

}



cout << "payment has been transfered";

}

main(){

char ch;

do{

int choice;

cout << "Press 1 for deposite money" <<endl;

cout << "Press 2 for withdraw money" <<endl;

cout << "Press 3 for check balance" <<endl;

cout << "Press 4 for transfer money" <<endl;

cout << "Press 5 to exit the program" <<endl;



cout << "Enter your choice" <<endl;

cin >> choice;



switch(choice){

case 1:

deposite();

break;

case 2:

withdraw();

break;

case 3:

balance();

break;

case 4:

transfer();

break;

case 5:

exit(0);

break;

default:

cout << "Invalid input";



}

cout << "Press Y or y to continue program" <<endl;

cin >> ch;





}while(ch == 'Y' || ch == 'y');





}

No comments:

Post a Comment