Write a C++ function to format numbers as two digits.
/*** Formats a number as 2 digits, with a leading 0 if needed** @param n number to format, assumed between 0 and 59,inclusive* @return two digit string representation of number*/string twoDigitString(unsigned int n) {/*** You may wish to change this function when you bring it into yourprogram.* For now please get it to work here with the existing functionsignature.* You may assume <string> has been included.*/// TODO: your code here to implement the method// return the two digit string}
Write a C++ function to format numbers as two digits. /** * Formats a number as 2 digits, with a leading 0 if needed * *
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Write a C++ function to format numbers as two digits. /** * Formats a number as 2 digits, with a leading 0 if needed * *
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!