Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USING C++ Write a program to practice how to use length(), find() and substr() funcitons. You should understand the first exercise before you try this

USING C++

Write a program to practice how to use length(), find() and substr() funcitons. You should understand the first exercise before you try this one.

Follow the steps below:

Declare a string variable: OriginalString.

Assign "And now for something completely different." to OriginalString.

Display the length of OriginalString.

Find and display the position of "completely" in the OriginalString.

Declare a string variable: NewString.

Use the substr() function to get this sub-string of OriginalString: "And now for something ". then assign it to NewString.

Output NewString.

Get a sub-string of OriginalString with value "different.". Add this substring to NewString.

Display NewString. The output should look like this: And now for something different.

Compile and run this C++ program.

Show your lab instructor the program output.

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

Step: 3

blur-text-image

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions