本文整理汇总了C++中BankAccount::GetRecentTransactions方法的典型用法代码示例。如果您正苦于以下问题:C++ BankAccount::GetRecentTransactions方法的具体用法?C++ BankAccount::GetRecentTransactions怎么用?C++ BankAccount::GetRecentTransactions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BankAccount
的用法示例。
在下文中一共展示了BankAccount::GetRecentTransactions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: atm
int atm()
{
CinReader reader;
BankAccount myBanking;
bool end_program = false;
bool done = false;
long dollars;
int cents;
do
{
cout << "Select the type of account you wish to create" << endl;
cout << "1 Bank Account 2 - Checking 3 - Savings 4 - Credit\n" << endl;
int choice = reader.readInt(1,4);
string account_name;
long balance_dollars;
int balance_cents;
double interest_rate;
switch(choice)
{
//Bank account options
case 1:
{
cout << "Set the dollar amount of your account balance\n" << endl;
balance_dollars = reader.readInt(0);
cout << "Set the cent amount of your account balance\n" << endl;
balance_cents = reader.readInt(0,99);
myBanking.SetDollars(balance_dollars);
myBanking.SetCents(balance_cents);
cout << "Please select from the following options." << endl;
while(!done)
{
cout << "1 - Show account balance\n2 - Deposit\n3 - Withdraw\n4 - Show recent transactions\n5 - Clear Transaction history\n6 - Exit ATM\n" << endl;
int choice = reader.readInt(1,6);
switch(choice)
{
case 1:
{
cout << myBanking.ShowBalance() << endl;
break;
}
case 2:
{
cout << "Please enter the amount in dollars you would like to deposit, followed by the amount in cents\n" << endl;
dollars = reader.readInt(0);
cents = reader.readInt(0,99);
myBanking.DepositAccount(dollars, cents);
break;
}
case 3:
{
cout << "Please enter the amount in dollars you would like to withdraw, followed by the amount in cents\n" << endl;
dollars = reader.readInt(0);
cents = reader.readInt(0,99);
myBanking.WithdrawAccount(dollars, cents);
break;
}
case 4:
{
for(int i = 0;i<10;i++)
{
if(myBanking.GetRecentTransactions(i) == "")
{
cout << "none" << endl;
}else
{
cout << myBanking.GetRecentTransactions(i) << endl;
}
}
cout << "Your last transaction was: " << myBanking.GetLastTransaction() << endl;
break;
}
case 5:
{
myBanking.ClearRecentTransactions();
break;
}
case 6:
{
done = true;
}
}
}
break;
}
//Checking account options
case 2:
{
CheckingAccount myChecking;
cout << "Set the dollar amount of your account balance" << endl;
balance_dollars = reader.readInt(0);
cout << "Set the cent amount of your account balance\n" << endl;
balance_cents = reader.readInt(0,99);
myChecking.SetDollars(balance_dollars);
//.........这里部分代码省略.........