本文整理汇总了C++中BankAccount::View_balance方法的典型用法代码示例。如果您正苦于以下问题:C++ BankAccount::View_balance方法的具体用法?C++ BankAccount::View_balance怎么用?C++ BankAccount::View_balance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BankAccount
的用法示例。
在下文中一共展示了BankAccount::View_balance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
PortfolioList.SortLinkedList(); //sort the Linked List
PortfolioList.printList(); //print the Linked List
break;
case 3:
flag1=stock.buy_shares(company_name,price_per_share); //buy shares
already_in_list=stock.alreadyInList(account_sym,account_index); //check to see if the stock is already in list
if(flag1) //if transaction went through
{
type="Buy";
if(already_in_list) //if in list
{
stock.update_account_information(account_sym,account_num,account_price,account_total,account_index); //just update the list(no new entry)
}
else //if it's not in the list
{
stock.store_account_information(stock); //store the stock in account information
}
}
stock.store_transaction(stock,type); //store tranaction in file
break;
case 4:
flag2=stock.sell_shares(account_sym,account_price); //sell shares
already_in_list=stock.alreadyInList(account_sym,account_index); //check to see if the stock is already in list
if(flag2) //if transaction went through
{
type="Sell";
stock.update_sell_information(account_sym,account_num,account_price,account_total,account_index); //just update the list
}
stock.store_transaction(stock,type); //store tranaction in file
break;
case 5:
stock.read_transaction_history(trans_type,trans_sym, trans_num, trans_price,trans_total, trans_time);
cout<<"Event"<<setw(15)<<"Company Symbol"<<setw(9)<<"Number"<<setw(19)<<"Price per share"<<setw(15)<<"Total value"<<setw(11)<<"Time\n";
while(trans_sym[m]!="END")
{
cout<<trans_type[m]<<setw(7)<<trans_sym[m]<<setw(15)<<trans_num[m]<<setw(15)<<trans_price[m]<<setw(19)<<trans_total[m]<<setw(18)<<trans_time[m]<<endl;
m++;
}
m=0;
cout<<"\n";
break;
default:
cout<<"You entered an invalid number!"<<endl;
break;
}
}
break;
case 2:
//Bank Account
cout<<"\n\nBank Account"<<endl;
while(1)
{
cout<<"Please select an option:"<<endl
<<"1. View account balance"<<endl
<<"2. Deposit Money"<<endl
<<"3. Withdraw Money"<<endl
<<"4. Print out history"<<endl
<<"5. Return to previous menu"<<endl;
cin>>option;
if(option==5) //return to previous menu
break;
switch(option)
{
case 1:
myAccount.View_balance(); //View Balance
break;
case 2:
cout<<"Please enter the amount: "<<endl;
cin>>myAmount;
myAccount.Deposit(myAmount);
break;
case 3:
cout<<"Please enter the amount: "<<endl;
cin>>myAmount;
myAccount.Withdraw(myAmount);
break;
case 4:
myAccount.Print_history();
break;
default:
cout<<"You entered an invalid number!"<<endl;
break;
}
}
break;
case 3: //exit the program
exit(0);
default:
break;
}
}
return 0;
}