Question: //can anyone help me create these. ive done two so far //1st code no loops! //second code no loops! #include using namespace std; /** Mix
//can anyone help me create these. ive done two so far
//1st code no loops!

//second code no loops!
#include
using namespace std;
/** Mix two strings by alternating characters from them. If one string runs out before the other, just pick from the longer one. For example, mix("Fred", "Wilma") is "FWrieldma". Use recursion. Do not use loops. Hint: str.substr(1) is the substring of str from position 1 to the end. */ string mix(string a, string b) { }
//third code no loops!
#include
using namespace std;
/** Given a string, return a string of all lowercase letters contained in it. Use recursion. Do not use loops. A lowercase letter is a character between 'a' and 'z' inclusive. Hint: str.substr(1) is the substring of str from position 1 to the end. */ string lcl(string str) {
}
//4th code no loops!

/* Write a recursive function to compute the number of bits in a nonnegative integer n. For example, bits(13) is 3 since 13 in binary is 1101.
Hint: The last bit of a number is 1 if the number is odd and 0 if the number is even. */ int bits(int n) { int count; int rem = n % 2; if(n 1 && rem == 0){return count + bits(n/2);} else if (n > 1 && rem == 1) { count++; return count + bits(n/2); } }
#include
Step by Step Solution
There are 3 Steps involved in it
Lets tackle each of these problems one by one 1 Mixing Two Strings Recursive You need a function to mix two strings by alternating characters from each with recursion and no loops Heres how you can do ... View full answer
Get step-by-step solutions from verified subject matter experts
