Page 1 of 1

Write a function to format numbers as two digits. /** * Formats a number as 2 digits, with a leading 0 if needed * *

Posted: Thu Jul 14, 2022 2:13 pm
by answerhappygod
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}