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

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 12RQ
icon
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
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning