Update implemented toString function
This commit is contained in:
@ -36,5 +36,12 @@ bool Wallet::containsCurrency(std::string type, double amount)
|
||||
|
||||
std::string Wallet::toString()
|
||||
{
|
||||
return "Oink!";
|
||||
std::string s;
|
||||
for(std::pair<std::string, double> pair : currencies)
|
||||
{
|
||||
std::string currency = pair.first;
|
||||
double amount = pair.second;
|
||||
s += currency + " : " + std::to_string(amount) + "\n";
|
||||
}
|
||||
return s;
|
||||
}
|
||||
Binary file not shown.
@ -12,7 +12,8 @@ int main()
|
||||
//app.init();
|
||||
Wallet wallet;
|
||||
wallet.insertCurrency("BTC", 10);
|
||||
std::cout << "Wallet has BTC " << wallet.containsCurrency("BTC", 11) << std::endl;
|
||||
wallet.insertCurrency("USDT", 100.83);
|
||||
std::cout << "Wallet has BTC " << wallet.containsCurrency("USDT", 100.50) << std::endl;
|
||||
std::cout << wallet.toString() << std::endl;
|
||||
//CSVReader::readCSV("20200317.csv");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user