1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
dedylja [7]
3 years ago
8

Given a string, an integer position, and a character, all on separate lines, find the character of the string in that position a

nd replace it with the character read. Then, output the result.
SAT
1 answer:
Korolek [52]3 years ago
3 0

Following are the C++ program to replace a character value from the input string:

Program Explanation:

  • Defining header file.
  • Defining the main method.
  • Defining three different types of variables "str, P, and Ch" that are "string, integer, and character".
  • After input value into the above variable, a character at method is declared that <em><u>takes position index value and replaced by character</u></em>.
  • At the last using print method that <em><u>prints replaced string value</u></em>.

Program:

#include <iostream>//header file

#include <string>//header file

using namespace std;

int main() //main method

{

   //defining variables

 string str;//string

 int P;//integer

 char Ch;//character

 cin>>str;//input string value

 cin >>P;//input integer value

 cin >> Ch;//input character value

 str.at(P)  = Ch; //uing char-at method that takes position index value and replaced by character

 cout << str << endl;//print replaced string value

 return 0;

}

Output:

Please find the attached file.

Learn more:

brainly.com/question/24497583

You might be interested in
If f(–5) = 0, what are all the factors of the function mc022-1. Jpg? use the remainder theorem. (x – 2)(x + 5)(x – 3) (x + 2)(x
labwork [276]

Answer:

Answer this and I'll answer yours.

A rectangle has side lengths of 3x+1 and 5+2x units. What is its perimeter in terms of x?

Explanation:

3 0
3 years ago
Read 2 more answers
3. What is the meaning of "radical" as it is used in
kobusy [5.1K]
The answer is profound
7 0
3 years ago
Be my friends plssssssssssssssssssssssssssssssssssssss
Yuki888 [10]

Answer:

bet

Explanation:

5 0
3 years ago
Read 2 more answers
Which of the following lists the layers of the Sun in order from the inner to outer layers?
MAVERICK [17]
What are the answer choices?
7 0
3 years ago
7. In how many ways can the 40 members of a 4H club elect a president, a vice president,
Kazeer [188]

Answer:

59280

Explanation:

40*39*38 is the answer

7 0
4 years ago
Other questions:
  • Amit is going to guess on all 20 questions of his multiple-choice test. Each question on the test has 4 answer options, and only
    6·2 answers
  • To investigate any question about the natural world, what must you do?
    11·1 answer
  • A man has 13 eggs, 6 eggs broke how many eggs are remaining in his basket?​
    8·2 answers
  • Do you like my fox. Free 20 points!!
    8·2 answers
  • In our own nation, the Boston Tea Party represented a massive act of civil disobedience. Why does King use this allusion? to est
    11·1 answer
  • a universal life policy is sometimes referred as an unbundled life policy because the owner can see the interest earned, cost of
    15·1 answer
  • Read the sample advertisement. Lose body fat and feel healthier with our proven supplement, Edgozene! Losing weight is easy with
    5·1 answer
  • A zookeeper predicted that the weight of a newborn lion would be 2. 8 pounds. When the zoo’s lion gave birth, the newborn weighe
    13·2 answers
  • A firm evaluates all of its projects by applying the irr rule. year cash flow 0 −$157,300 1 74,000 2 87,000 3 46,000 a. what is
    12·1 answer
  • A(n) __________ agent is NOT a type of intelligent agent.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!