Starting from:

$30

CSE114-Assignment 4 Solved

In this assignment you are going to write a program that takes a string, and two capital letters as an input. Your program will check the elements of the string, and if they are letters that are in between given capital letters, it will move them to the end of the string.

For example,

If the input capital letters are A and D, the program is going to move the characters “a A b B c C d D” to the end of the string.

Input string: “This is a ABc test” Ouput string: “This is testaABc”

You are not going to use any libraries other than <stdio.h>.

●     Function 1:

○     Name of the function: isInBetween

                        ○    Return type of the function: int

                        ○    1. Parameter: character 1

                        ○    2. Parameter: character 2

                        ○    2. Parameter: a char pointer to the string

○    You are going to use this function to check if the characters in the string are in between given letters or not. Assume the input characters are always capital letters.

●     Function 2: 

○     Name of the function: moveToEnd

                        ○    Return type of the function: void

                        ○    1. Parameter: a char pointer to the string

                        ○    2. Parameter: an integer to represent left element

                        ○    3. Parameter: an integer to represent right element

                        ○    4. Parameter: First char (ch1)

                        ○    5. Parameter: Second char (ch2)

○    In this function you will check the elements of the string and move the letters that are in between ch1 and ch2 to the end of the string. You are going to use first function to check if the elements of the strings are in between or not.

○    You are expected to use pointer notation to change the input string. You are not allowed to use a second string (If you use a second string, your homework will be evaluated out of .

                        ○    Do not use any loop structures.

●     Main function: 

○     Enter a string for testing you code.

                        ○    Call the moveToEnd function to print the final output.

More products