Kat H.

asked • 04/26/21

String Compactor. Write code that will read in a string and then print out every other character of the string.

Write code that will read in a string and then print out every other character of the string. You should use getline to read in the string... it may have spaces.


Samples:

  1. Input of "Hello" should produce "Hlo"
  2. Input of "Hi there" should produce "H hr"
  3. Input of "What" should produce "Wa"


Note: You do not have to actually change the string... it is fine to just print the correct characters.


Code:


#include <iostream>

using namespace std;


int main()

{

//YOUR_CODE

}

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.