Write a C program Write a recursive string valued function r

-Write a C program. Write a recursive, string -valued function, replace, that accepts a string and returns a new string consisting of the original string with each blank replaced with an asterisk (*)

-Write a C program. A palindrome is a string that reads the same forwards or backwards; for example dad, mom, deed (i.e., reversing a palindrome produces the same string ). Write a recursive, bool-valued function, isPalindrome that accepts a string and returns whether the string is a palindrome.

-Write a C program. Assume you need to test a function named max. The function max receives two int arguments and returns the larger . Write the definition of driver function testmax whose job it is to determine whether max is correct. So testmax returns true if max is correct and returns false otherwise.

-Write a C program. Assume you need to test a function named inOrder. The function inOrder receives three int arguments and returns true if and only if the arguments are in non-decreasing order: that is, the second argument is not less than the first and the third is not less than the second. Write the definition of driver function testInOrder whose job it is to determine whether inOrder is correct. So testInOrder returns true if inOrder is correct and returns false otherwise.

Solution

Answer of 3rd:

#include <stdio.h>
#include<stdbool.h>
int main(void) {
   bool checkmax(){
int large = 17;
int small = 7;
if (max(large,small)== large) {
return true;
}
return false;
}
   return 0;
}

Answer of 4th:

#include <stdio.h>
#include<stdbool.h>
int main(void) {
   bool checkinOrder()
{
if
(
(inOrder(2,3,4)==true) &&
(inOrder(4,2,3)==false) &&
(inOrder(6,7,8)==true) &&
(inOrder(1,5,1)==false) &&
(inOrder(7,8,1)==false) &&
(inOrder(2,2,3)==true) &&
(inOrder(9,2,6)==false) &&
(inOrder(3,2,1)==false) &&
(inOrder(1,2,3)==true)
)
return true;
else
return false;
}
   return 0;
}

-Write a C program. Write a recursive, string -valued function, replace, that accepts a string and returns a new string consisting of the original string with e

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site