Question
Write all the programs in C++ (recursive) and provide comments 1. Write in C++ recursive write backwards and then forwards // precondition: n > 0
Write all the programs in C++ (recursive) and provide comments
1. Write in C++ recursive write backwards and then forwards // precondition: n > 0 Write to the output stream out which has as default value std :: cout. Use the function prototype The call writeBackwardForward(123456) outputs 654321 123456
void writeBackwardForward (unsigned int n , s t d : : ostream& out = s t d : : c ou t ) {
}
2. Write in C++ recursive - Find the maximum no // precondition: // 1 <= n <= declared size of the array A int maximum(const int A[], int n){
}
3. Write in C++ recursive - Check if the array is in descending order bool isStrictlyDescending(const int A[], int n){
}
4. Write in C++ recursive - swap pairs of elements in an array // precondition: // 1 <= n <= declared size of the array A Examples if the array A has the values 11 22 33 44 55 66 and n = 6 then after the call to swapPairsLeftToRight, A has the values 22 11 44 33 66 55 if the array A has the values 11 22 33 44 55 and n = 5 then after the call to swapPairsLeftToRight, A has the values 22 11 44 33 55
void swapPairsLeftToRight(int A[], int n){
}
5. Write in C++ recursive determine if in alphabetical order in a dictionary goesFirst returns 0 if strA is equal to strB a positive value if strA goes first in a dictionary i.e. strA is listed before strB a negative value if strB goes first in a dictionary i.e. strB is listed before strA
short goesFirst(const string& strA, const string& strB){
}
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