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 // Only library you will need to 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!