Arrays 无法将元素保留在布尔值“后的向量中”;“边做边做”;环
我正在为intro CS课程制定比特币管理计划,以下是我的目标(仅在本文中提及我需要的目标):我已成功完成以下目标。 我的程序在classArrays 无法将元素保留在布尔值“后的向量中”;“边做边做”;环,arrays,loops,vector,boolean,element,Arrays,Loops,Vector,Boolean,Element,我正在为intro CS课程制定比特币管理计划,以下是我的目标(仅在本文中提及我需要的目标):我已成功完成以下目标。 我的程序在classmenu中存储了4个菜单选项。用户可以从以下选项中进行选择: 以美元为单位查找当前比特币价值 买卖比特币 打印当前余额 打印交易记录 假设用户选择选项2并输入用户希望销售或购买的数量。到目前为止,该计划将执行以下操作: 计算比特币的价值(每1 BTC随机生成5k到7k) 检索用户希望以美元购买的金额 将美元值转换为类wallet中的BTC,并从类getLiv
menu
中存储了4个菜单选项。用户可以从以下选项中进行选择:
- 计算比特币的价值(每1 BTC随机生成5k到7k)
- 检索用户希望以美元购买的金额
- 将美元值转换为类
中的BTC,并从类wallet
中检索交易的当前日期getLive
- 然后将这两个值转换为类型
,并传递到函数string
void bitcoinHistory(string bitcoinAmnt,string date)
- 。。。并将这两个字符串存储在名为
的类中,并打印出交易历史记录。用户可以进行任意数量的交易。ledger
push\u back.(
)
class ledger // the log of all transactions
//1) It will store the transaction strings just so we have
//a record of the buy sell commands
//2) It will be able to print out the transaction history if requested
{
public:
vector<string> bitcoin;
void bitcoinHistory(string bitcoinAmnt, string date)
{
string btc, time;
btc = bitcoinAmnt;
time = date;
bitcoin.push_back(btc + "BTC on " + time);
for (unsigned int x = 0; x < bitcoin.size(); x++)
{
cout << bitcoin[x] << endl;
}
repeat = true; \\ boolean returns the user back to main menu
分类账//所有交易的日志
//1) 它将存储事务字符串,以便
//买卖命令的记录
//2) 如果需要,它将能够打印出交易历史记录
{
公众:
矢量比特币;
无效bitcoinHistory(字符串bitcoinAmnt,字符串日期)
{
字符串btc,时间;
btc=比特币;
时间=日期;
比特币。推后(btc+“btc开启”+时间);
对于(无符号整数x=0;x