Question: std::string displayMoney(int amount) { // Here the money will be displayed using the to_string() function std::string dollars{ std::to_string(amount/100) }; std::string cents{ std::to_string(std::abs(amount%100)) }; return $

std::string displayMoney(int amount) {

// Here the money will be displayed using the to_string() function std::string dollars{ std::to_string(amount/100) }; std::string cents{ std::to_string(std::abs(amount%100)) };

return "$" + dollars + "." + (cents.size() == 1 ? "0" : "") + cents; }

HOW would i do this in the swift programming language

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!