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
Accessing calendars, contact information, email, files and folders, instant messaging, presentations, and task lists over the in
Illusion [34]
The answer is Cloud Computing.  It access calendars, contact information, email, files and folders, instant messaging, presentations, and task lists over the internet. This means, if you have a device and an internet connection, you can have your "office" anywhere, anytime.
4 0
3 years ago
Read 2 more answers
Though there are no specific federal laws for cyberbullying, in some cases cyberbullying
inessss [21]
Cyberbullying overlaps with discriminatory harassment
7 0
3 years ago
A user reports his or her computer is slow to boot. You check the boot order and determine that the computer is checking the C d
Nata [24]
You could turn off memory testing, but defragmentating and running chkdsk on C: would be better to try first.
6 0
3 years ago
Angle parking spaces are generally entered at an angle about __________ from the curb.
Artyom0805 [142]
Probably B. 45 degrees
8 0
3 years ago
Read 2 more answers
In older systems, often the user interface mainly consisted of _____ screens that allowed a user to send commands to the system.
marshall27 [118]

Answer:

Option (2) i.e.,  process-control is the correct answer

Explanation:

In the following statement, Process-control screen provides users to send command to the system when the interface of the following users is mainly made up of in the older systems. So, that's why the user interface generally consists of a process-control screen which permits the user to transfer the following details in the system.

7 0
3 years ago
Other questions:
  • ) Consider a router that interconnects four subnets: Subnet 1, Subnet 2, Subnet 3 and Subnet 4. Suppose all of the interfaces in
    11·1 answer
  • A(n) ________ file contains data that has been encoded as text, using one of the computer's encoding schemes.
    14·2 answers
  • A program uses two classes: dog and poodle. which class is the base class and which is the derived class?
    7·2 answers
  • Which is not a proper statement?
    14·2 answers
  • If I wanted to include a picture of a dog in my document, I could use
    13·2 answers
  • Answer this question for points lol
    7·2 answers
  • D. DROP
    6·1 answer
  • Write a method that returns a String that is just the first and last character of the given string Your return value should be o
    8·1 answer
  • Give me 5 examples of Cyber Security
    9·1 answer
  • To set up scenarios, you need to first use ______ to set up a list, then ______ to set up the reference cell. Last you need to u
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!