Question: In C + + please! Read in a string from cin ( it will not have any whitespace ) . Print out the first character,

In C++ please! Read in a string from cin (it will not have any whitespace). Print out the first character, middle character (if string is an even length, print the second of the two middle letters), and last character without any spaces.
Samples:
Input: hello Output: hlo Input: number Output: nbr
Hints:
To get the middle/last you will need to first get the length of the string and calculate based on that
The index of the last letter is not the same as the length! In "hello", the 'o' is at location 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!