Assignment 3 CS221: C and Systems Programming – Fall 2019
In the problems for this assignment, you are to complete the body of the functions as specified. You may not modify the functions signatures, that is, adding any new parameters or changing the data type of the parameters in any way. You may not use square brackets and any type of loops in your solutions.
1. Write the body of the function below so that it recursively converts all lowercase letters in a string to uppercase. For example: toUpperCase("aBcD?2") -> "ABCD?2" void toUpperCase ( char * str ) { }
2. Write a recursive program that receives an array of positive integers and its length and returns the largest number in the array. For example: int arr[5] = {-2, 31, 4, 12, -8}; findMax(arr, ...) -> 31 int findMax ( int * arr , int p , int max ) { }
3. Write a program in C to reverse a string using recursion. For example: reverse("abcde", ...) -> "edcba" void reverse ( char * str , int i , int s ) { }
4. Write a function in C to convert a decimal number to binary using recursion. For example: convertToBinary(10) -> 1010 long convertToBinary ( int num ) { }
5. Write a function that checks whether a given string is a palindrome or not, recursively. Palindrome is a word,
phrase, or sequence that reads the same backward as forward. For example:
isPalindrome("abcba", ...) -> true
isPalindrome("abcb1", ...) -> false
bool isPalindrome ( char * str , int s , int e )
{
}
Submission:
Prior to the deadline upload only one file Answers.{pdf, doc(x), txt} file containing your answer to all problems
to Canvas. Include your name and student ID at the top of the document. Submission on Canvas will be opened
one week prior to the deadline.
Get Free Quote!
268 Experts Online