Hi, Im new to programming. I am taking a class at a local college and I don't really understand how to create recursion. I have a homework problem that requires me to input an integer between 1 and 32767 and print is as a series of digits each digit is separated by 2 spaces. i.e 4762 would be 4 7 6 2. Could anybody help me out with the recursion. I have a forumla to calculate the number of the digits and it is:
double logint;//
cout << "Please input an integer between 1 and 32767: "; // Input
cin >> number;
logint = log10(number); // The floor of the log base 10 + 1 is equal to the number of digits in the integer
numberdig = floor(logint+1);
where numberdig is the number of digits in the number.
Could someone help?
Edit/Delete Message
double logint;//
cout << "Please input an integer between 1 and 32767: "; // Input
cin >> number;
logint = log10(number); // The floor of the log base 10 + 1 is equal to the number of digits in the integer
numberdig = floor(logint+1);
where numberdig is the number of digits in the number.
Could someone help?
Edit/Delete Message