promotion image of download ymail app
Promoted

c++ problem?

> Create a program StrCut.c to do the following:

> In the main, you will three inputs from user:

> A. A string (it can be multiple words)

> B. Start index

> C. End index

>

Then, you will call myStrCut function which will take these three inputs as arguement and create a new array containing only characters within the range of start index to end index (including characters at start index and end index) and later print that new array. You should check whether the start and end indices are within valid range (between 0 to length of that string -1). For example, if the input is apple the valid range would be from 0 to 4 (length of string -1). You should check this in main function before calling my StrCut function.

> Sample Input / Output:

>

> Enter the string:

> **Apple**

> Enter the start index:

> **1**

> Enter the end index:

> **3**

> Here is your new string

> ppl

**Sample Input / Output**

Enter the string:

**Apple**

Enter the start index:

**2**

Enter the end index:

**7**

Please enter the valid indices

Sample Input / Output:

Enter the string:

**This is CSCI 155**

Enter the start index:

**5**

Enter the end index:

**13**

Here is your new string:

**is CSCI 1**

There are no answers yet.
Be the first to answer this question.