diff --git a/CM2005 Object Oriented Programming/Topic 5/5.1.9/Wallet.cpp b/CM2005 Object Oriented Programming/Topic 5/5.1.9/Wallet.cpp index c0c2ce1..474c6c8 100644 --- a/CM2005 Object Oriented Programming/Topic 5/5.1.9/Wallet.cpp +++ b/CM2005 Object Oriented Programming/Topic 5/5.1.9/Wallet.cpp @@ -36,5 +36,12 @@ bool Wallet::containsCurrency(std::string type, double amount) std::string Wallet::toString() { - return "Oink!"; + std::string s; + for(std::pair pair : currencies) + { + std::string currency = pair.first; + double amount = pair.second; + s += currency + " : " + std::to_string(amount) + "\n"; + } + return s; } \ No newline at end of file diff --git a/CM2005 Object Oriented Programming/Topic 5/5.1.9/a.exe b/CM2005 Object Oriented Programming/Topic 5/5.1.9/a.exe index 606c3ec..d08a97e 100644 Binary files a/CM2005 Object Oriented Programming/Topic 5/5.1.9/a.exe and b/CM2005 Object Oriented Programming/Topic 5/5.1.9/a.exe differ diff --git a/CM2005 Object Oriented Programming/Topic 5/5.1.9/main.cpp b/CM2005 Object Oriented Programming/Topic 5/5.1.9/main.cpp index 93bf4e3..45cbe4e 100644 --- a/CM2005 Object Oriented Programming/Topic 5/5.1.9/main.cpp +++ b/CM2005 Object Oriented Programming/Topic 5/5.1.9/main.cpp @@ -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");