Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//done in C please Write a program that reads from the user some text in a string str that can hold a maximum of 40

//done in C please

Write a program that reads from the user some text in a string str that can hold a maximum of 40 characters and then it splits the string into two other strings as follows: all the even-position characters are copied into a string called even and all the odd-position characters are copied into a string called odd. The program should then print out the even and odd strings. Your program should use char * variables (pointer to char) to traverse the strings str, even and odd .

The program should behave as follows (items in italics are entered by the user):

Enter a string (40 characters maximum): abcdefg

The even string is: aceg

The odd string is: bdf

image text in transcribed

image text in transcribed

Write a program that reads from the user some text in a string str that can hold a maximum of 40 characters and then it splits the string into two other strings as follows: all the even-position characters are copied into a string called even and all the odd-position characters are copied into a string called odd. The program should then print out the even and odd strings. Your program should use char * variables (pointer to char) to traverse the strings str, even and odd. The program should behave as follows (items underlined are entered by the user) Enter a string (40 characters maximum): abcdefg The even string is: aceg The odd string is: bdf

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago