Given a string, an integer position, and a character, all on separate lines, find the character of the string in that position an replace it with the character read. Then, output the result. Ex: If the input is: warn e the output is: earn
Given a string, an integer position, and a character, all on separate lines, find the character of the string in that position an replace it with the character read. Then, output the result. Ex: If the input is: warn e the output is: earn
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 12RQ
Related questions
Question
![Jump to level1
Given a string, an integer position, and a character, all on separate lines, find the character of the string in that position and
replace it with the character read. Then, output the result.
Ex: If the input is:
warn
e
the output is:
earn
Note: Using a pre-defined string function, the solution can be just one line of code.
1 #include <iostream>
2 #include <string>
3 using namespace std;
5 int main) {
string workStr;
int strIndex;
char altChar;
8.
Search or type URL](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F2bb941ff-1954-4560-9ca2-87f245c32e9f%2F865b50d4-44b6-46d7-9c69-fa06a79f7559%2Fb92ioec_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Jump to level1
Given a string, an integer position, and a character, all on separate lines, find the character of the string in that position and
replace it with the character read. Then, output the result.
Ex: If the input is:
warn
e
the output is:
earn
Note: Using a pre-defined string function, the solution can be just one line of code.
1 #include <iostream>
2 #include <string>
3 using namespace std;
5 int main) {
string workStr;
int strIndex;
char altChar;
8.
Search or type URL
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning