日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

使用类的银行管理系统的C ++程序

發布時間:2025/3/11 windows 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 使用类的银行管理系统的C ++程序 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

In this program, we are using the concept of C++ class and object, following basic operations are being performed here,

在此程序中,我們使用C ++類和對象的概念,在此執行以下基本操作,

  • Opening an account

    開戶

  • Show account info

    顯示帳戶信息

  • Deposit

    存款

  • Withdraw

    退出

  • Search

    搜索

Note: It's a basic program just for the practice of the concept of class and object.

注意:這是一個基本程序,僅用于實現類和對象的概念。

In this program, we have created a class Bank with the following member functions,

在此程序中,我們創建了一個具有以下成員函數的Bank類,

  • OpenAccount() – It will take input account number, name and opening balance.

    OpenAccount() –將使用輸入的帳號,名稱和期初余額。

  • ShowAccount() – It will display the account details such as account number, name and balance.

    ShowAccount() –將顯示帳戶詳細信息,例如帳號,名稱和余額。

  • Deposit() – It will ask for the amount to be added in available balance, and deposit the amount.

    Deposit() –它將要求將金額添加到可用余額中,并存入金額。

  • Withdrawal() – It will ask for the amount to be withdrawn from the available, will also check the available balance, if balance is available, it will deduct the amount from the available balance.

    Withdrawal() –它將要求從可用金額中提取金額,還將檢查可用余額,如果余額可用,則會從可用余額中扣除金額。

  • Search() – It will search for the record and display the account info.

    Search() –它將搜索記錄并顯示帳戶信息。

銀行管理系統的C ++程序 (C++ program for banking management system)

#include <iostream> using namespace std;// class class Bank { private:int acno;char name[30];long balance;public:void OpenAccount(){cout << "Enter Account Number: ";cin >> acno;cout << "Enter Name: ";cin >> name;cout << "Enter Balance: ";cin >> balance;}void ShowAccount(){cout << "Account Number: " << acno << endl;cout << "Name: " << name << endl;cout << "Balance: " << balance << endl;}void Deposit(){long amt;cout << "Enter Amount U want to deposit? ";cin >> amt;balance = balance + amt;}void Withdrawal(){long amt;cout << "Enter Amount U want to withdraw? ";cin >> amt;if (amt <= balance)balance = balance - amt;elsecout << "Less Balance..." << endl;}int Search(int); };int Bank::Search(int a) {if (acno == a) {ShowAccount();return (1);}return (0); }// main code int main() {Bank C[3];int found = 0, a, ch, i;for (i = 0; i <= 2; i++) {C[i].OpenAccount();}do {// display optionscout << "\n\n1:Display All\n2:By Account No\n3:Deposit\n4:Withdraw\n5:Exit" << endl;// user inputcout << "Please input your choice: ";cin >> ch;switch (ch) {case 1: // displating account infofor (i = 0; i <= 2; i++) {C[i].ShowAccount();}break;case 2: // searching the recordcout << "Account Number? ";cin >> a;for (i = 0; i <= 2; i++) {found = C[i].Search(a);if (found)break;}if (!found)cout << "Record Not Found" << endl;break;case 3: // deposit operationcout << "Account Number To Deposit Amount? ";cin >> a;for (i = 0; i <= 2; i++) {found = C[i].Search(a);if (found) {C[i].Deposit();break;}}if (!found)cout << "Record Not Found" << endl;break;case 4: // withdraw operationcout << "Account Number To Withdraw Amount? ";cin >> a;for (i = 0; i <= 2; i++) {found = C[i].Search(a);if (found) {C[i].Withdrawal();break;}}if (!found)cout << "Record Not Found" << endl;break;case 5: // exitcout << "Have a nice day" << endl;break;default:cout << "Wrong Option" << endl;}} while (ch != 5);return 0; }

Output

輸出量

Enter Account Number: 111 Enter Name: Shivang EnterBalance: 30000 Enter Account Number: 112 Enter Name: Radib EnterBalance: 20000 Enter Account Number: 123 Enter Name: Prem EnterBalance: 10000 1:Display All 2:By Account No 3:Deposit 4:Withdraw 5:Exit Please input your choice: 1 Account Number: 111 Name: Shivang Balance: 30000 Account Number: 112 Name: Radib Balance: 20000 Account Number: 123 Name: Prem Balance: 100001:Display All 2:By Account No 3:Deposit 4:Withdraw 5:Exit Please input your choice: 2 Account Number? 111 Account Number: 111 Name: Shivang Balance: 300001:Display All 2:By Account No 3:Deposit 4:Withdraw 5:Exit Please input your choice: 3 Account Number To Deposit Amount? 112 Account Number: 112 Name: Radib Balance: 20000 Enter Amount U want to deposit? 20000 1:Display All 2:By Account No 3:Deposit 4:Withdraw 5:Exit Please input your choice: 2 Account Number? 112 Account Number: 112 Name: Radib Balance: 400001:Display All 2:By Account No 3:Deposit 4:Withdraw 5:Exit Please input your choice: 4 Account Number To Withdraw Amount? 111 Account Number: 111 Name: Shivang Balance: 30000 Enter Amount U want to withdraw? 150001:Display All 2:By Account No 3:Deposit 4:Withdraw 5:Exit Please input your choice: 1 Account Number: 111 Name: Shivang Balance: 15000 Account Number: 112 Name: Radib Balance: 40000 Account Number: 123 Name: Prem Balance: 100001:Display All 2:By Account No 3:Deposit 4:Withdraw 5:Exit Please input your choice: 5 Have a nice day

翻譯自: https://www.includehelp.com/cpp-programs/banking-management-system-using-class.aspx

總結

以上是生活随笔為你收集整理的使用类的银行管理系统的C ++程序的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。