python_bank_system's Introduction
뱅킹시스템 과제 #include <iostream> #include <cstring> using namespace std; const int accSize = 10;//최대 계좌수 const int adminPassword = 0000;//관리자 암호 설정 void Menu(void);//메뉴 출력 void MakeAccount(void);//계좌개설 void Deposit(void);//입금 void Withdraw(void);//출금 void Balance(void);//잔액조회 void allBalance(void);//모든계좌 정보조회 typedef struct { int accID; char name[20]; int balance; } Account; Account accSave[accSize]; int accNum = 0; int main(void) { int select; while (1) { Menu(); cout << "선택 : "; cin >> select; cout << endl; switch (select) { case 1: MakeAccount(); break; case 2: Deposit(); break; case 3: Withdraw(); break; case 4: Balance(); break; case 5: allBalance(); break; case 6: return 0; default: cout << "올바른 선택이 아닙니다." << endl; } } return 0; } void Menu(void) { cout << "-----Menu-----" << endl; cout << "1.계좌개설" << endl; cout << "2.입 금" << endl; cout << "3.출 금" << endl; cout << "4.잔액조회" << endl; cout << "5.모든계좌 정보 출력" << endl; cout << "6.프로그램 종료" << endl; } void MakeAccount(void) { int id; char name[20]; int money; cout << "[계좌개설]" << endl; cout << "계좌ID : "; cin >> id; cout << "이 름 : "; cin >> name; cout << "입금액 : "; cin >> money; cout << endl; accSave[accNum].accID = id; strcpy(accSave[accNum].name, name); accSave[accNum].balance = money; accNum++; } void Deposit(void) { int id; int money; cout << "[입 금]" << endl; cout << "계좌ID : "; cin >> id; cout << "입금액 : "; cin >> money; for (int i = 0; i < accNum; i++) { if (accSave[i].accID == id) { accSave[i].balance += money; cout << "입금완료" << endl; return; } } cout << "잘못된 ID 입니다!" << endl << endl; } void Withdraw(void) { int id; int money; cout << "[출 금]" << endl; cout << "계좌ID : "; cin >> id; cout << "출금액 : "; cin >> money; for (int i = 0; i < accNum; i++) { if (accSave[i].accID == id) { if (accSave[i].balance < money) { cout << "잔액이 부족합니다." << endl; return; } accSave[i].balance -= money; cout << "출금완료" << endl; return; } } cout << "잘못된 ID 입니다!" << endl << endl; } void Balance(void) { int id; cout << "[잔액조회]" << endl; cout << "계좌ID : "; cin >> id; for (int i = 0; i < accNum; i++) { if (accSave[i].accID == id) { cout << "ID : " << accSave[i].accID << endl; cout << "이름 : " << accSave[i].name << endl; cout << "잔액 : " << accSave[i].balance << endl << endl; return; } } cout << "잘못된 ID 입니다!" << endl << endl; } void allBalance(void) { int confirm_password; cout << "[관리자 모드]" << endl; cout << "Input the admin password : "; cin >> confirm_password; if (accNum == 0) { cout << "Bank has no account..." << endl << endl; return; } if (confirm_password == adminPassword) { for (int i = 0; i < accNum; i++) { cout << "ID : " << accSave[i].accID << endl; cout << "이름 : " << accSave[i].name << endl; cout << "잔액 : " << accSave[i].balance << endl << endl; } } else { cout << "You are not admin!!!" << endl << endl; return; } }
python_bank_system's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.