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
Oduvanchick [21]
3 years ago
8

[C++] 4.17 LAB: Print string in reverse Write a program that takes in a line of text as input, and outputs that line of text in

reverse. The program repeats, ending when the user enters "Done", "done", or "d" for the line of text. Ex: If the input is: Hello there Hey done then the output is: ereht olleH yeH
Computers and Technology
1 answer:
Readme [11.4K]3 years ago
7 0

The program illustrates the use of string manipulations.

String manipulation involves carrying out several operations (such as splitting and reversing of strings).

The program in C++ where comments are used to explain each line is as follows:

#include <bits/stdc++.h>

using namespace std;

int main(){

   //This declares a string variable

string str;

//This gets input for the variable

getline(cin, str);

//The following is repeated, until the user inputs <em>"Done", "done" or "d"</em>

while(str != "Done" && str !="done" && str !="d"){

    //This reverses the string

    reverse(str.begin(), str.end());

    //This prints the reversed string

    cout << str<<endl;

    //This gets another input

    getline(cin, str);

}  

return 0;

}

At the end of each loop, the reversed string is printed.

See attachment for sample run

Learn more about similar programs at:

brainly.com/question/24833629

You might be interested in
Windows 8 uses a(n) ________ account for easy access and storage of online files.
Dafna1 [17]

Answer: OneDrive

Explanation: OneDrive

8 0
2 years ago
The part of the poppet valve that contacts the valve seat is called the?
Amiraneli [1.4K]
C. is the correct answer
6 0
4 years ago
Read 2 more answers
Carbon copy others who are..
My name is Ann [436]

Answer:

Is it Multiple Choice Question?

5 0
3 years ago
Read 2 more answers
You are given two processors P1 and P2 that execute the same instruction set but have different architectures. The instructions
mafiozo [28]

The answer & explanation for this question is given in the attachment below.

3 0
4 years ago
3. Radheshree has to complete her assignment and submit it on the next day. While typing
Dafna1 [17]

Answer:

she can use the onscreen keyboard

this application is present in accessories file in the windows

5 0
3 years ago
Other questions:
  • What is the purpose of lookup tables in spreadsheet software
    13·2 answers
  • Which of the following matching is true concerning the Protocol Data Unit (PDU) and its corresponding OSI layer location?
    15·1 answer
  • A viral video is one that can infect your computer with malware. <br> a. True <br> b. False
    6·1 answer
  • Write a program that produces a Caesar cipher of a given message string. A Caesar cipher is formed by rotating each letter of a
    14·1 answer
  • If a simple pipelined processor is super-pipelined by a factor of 3 (the ALU takes 3 cycles instead of one for the smallest oper
    15·1 answer
  • A web application is an example of:
    7·1 answer
  • You started writing a paper yesterday. You worked on it again today. After a few hours, you realized that you have introduced so
    15·2 answers
  • Please choose the correct option please tell fast​
    9·1 answer
  • Write a function magicCheck that takes a one-dimensional array of size 16, a two-dimensional array of four rows and four columns
    10·1 answer
  • 8. Which of the following is an output device
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!