Question: // ********** To DO: your names************ #include #include using namespace std; // ##### RECURSION THAT BEHAVES LIKE A LOOP ##### // These functions teach you
// ********** To DO: your names************ #include#include using namespace std; // ##### RECURSION THAT BEHAVES LIKE A LOOP ##### // These functions teach you how the recursive calls are working (remember the stack frame part) //This function count down recursively. So for countdown(5), it prints 5 4 3 2 1 void countdown(int n) { // Base case if (n < 1) return; // Recursive case cout << n << endl; countdown(n - 1); } // Implement countup recursively, so for countup(5), it should print 1 2 3 4 5 void countup(int n) { // ********** To DO************ } //Implement a recursive function (loopless) that print out n exclamation points // countcat(3) : !!! string countcat(int n) { // ********** To DO************ } // ##### CHECKING WHETHER A STRING IS A PALINDROME (the string and its reverse are similar) ##### // // Hint 1: you can call s.front() to get the first character of string and s.back() to get the last one // Hint 2: s.substr(i,j) gives you the substring of s. For example if s = Hello, s(1,s.length()-1) gives you ello bool is_palindrome(string s) { // ********** To DO************ } // ##### REVERSING A STRING ##### // string reverse(string s) { // ********** To DO************ } int main() { countdown(5) ; countup(5); string s = countcat(3); cout <
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
