Write a function to format numbers as two digits.
/** * Formats a number as 2 digits, with a leading 0 ifneeded * * @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 bringit into your program. * For now please get it to work here with the existingfunction signature. * You may assume <string> has beenincluded. */ // TODO: your code here to implement the method // return the two digit string}
Write a 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 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!