当前位置: 首页>>代码示例>>C++>>正文


C++ BankAccount::deposit方法代码示例

本文整理汇总了C++中BankAccount::deposit方法的典型用法代码示例。如果您正苦于以下问题:C++ BankAccount::deposit方法的具体用法?C++ BankAccount::deposit怎么用?C++ BankAccount::deposit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BankAccount的用法示例。


在下文中一共展示了BankAccount::deposit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mainMenu


//.........这里部分代码省略.........
								cin.ignore();
								cin >> minPrice;
							}

							stockObj.sellStock(&Node(stockSymbol, numberShare), minPrice);
                            
                            break;
                        case 5:
                            // view matlab graph
							cout << "\nPlease select the time period in the graph: " << endl;
							cout << "Start Date (mm/dd/yyyy): ";
							cin >> time_start;
							cout << "\nEnd Date (mm/dd/yyyy): ";
							cin >> time_end;
							stockObj.viewGraph(time_start, time_end);
                            
                            break;
                        case 6:
                            // view transaction history
							stockObj.viewHistory();
                            
                            break;
                        
                    } // end stock switch
                } while ( stockChoice != 7 );
                
                break;
            } // end case 1
            case 2:
            {
                // bank menu
                cout << "\nBank Account" << endl;

				// update balance
				bankObj.setBalance(stockObj.getBalance());

                int bankChoice; // choice for bank menu
                
                double amount; // amount of money to deposit or withdraw
                
                do {
                    bankInstruction();
                    cin >> bankChoice;
                    
					while (cin.fail()){
						cout << "\nPlease enter an integer value: ";
						cin.clear();
						cin.ignore();
						cin >> bankChoice;
					}

                    switch ( bankChoice ) {
                        case 1:
                            // view account balance
                            
							bankObj.viewBalance();
                            break;
                        case 2:
                            // deposit
							
                            cout << "Please select the amount you wish to deposit: $";
                            cin >> amount;
							
							while (cin.fail()){
								cout << "\nPlease enter a double value: $";
								cin.clear();
								cin.ignore();
								cin >> amount;
							}
							
							bankObj.deposit(amount);
                            break;
                        case 3:
                            // withdraw
                            cout << "Please select the amount you wish to withdraw: $";
                            cin >> amount;
                            
							while (cin.fail()){
								cout << "\nPlease enter a double value: $";
								cin.clear();
								cin.ignore();
								cin >> amount;
							}
							bankObj.withdraw(amount);

                            break;
                        case 4:
                            // print history
							bankObj.printHistory();
                            
                            break;
                    } // end bank switch
                } while ( bankChoice != 5 );
                
                break;
            } // end case 2
        } // end main switch
    } while ( mainChoice != 3 );

}
开发者ID:LishengZhou,项目名称:AccountManagementSystem,代码行数:101,代码来源:Main_zhou.cpp


注:本文中的BankAccount::deposit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。