Page 1 of 1

Write a C++ 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:17 pm
by answerhappygod
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}