Question
Comma Separate Number Write a recursive function that comma separates a number. The function must be recursive, no loops are allowed. You should only need
Comma Separate Number
Write a recursive function that comma separates a number.The function must be recursive, no loops are allowed. You should only need to use the library Do not use the following libraries: algorithm, cmath Example Input of 123 will produce 1, 2, 3 Input There will be no input read in anymore. Going forward use the hard-coded input on the template and ensure the program works. There will be one compare output test based on the hard-coded input. The rest of the tests will be unit tests. Output Print out the results from your function
#include
std::string commaSeparateInt( int num ){ // Always think base case first. The number will always be a positive number and will be getting smaller with each function call. // C++ has a function called to_string() which converts numerical values to strings. To call it use std::to_string(some value). }
int main(){
int num = 435678923; // Call your function on num and save the results // Print the results from your function call
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started