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
I want to sign up for brainly but it won't let me. It keeps saying "we can complete your registration at this time".
vekshin1
Try reinstalling the app or check if your wifi connection is good, if everything’s good but the app still doesn’t work then just use the website
5 0
3 years ago
What is the answer to this?
Anit [1.1K]

Answer: I think the Valorous Unit Ribbon

Explanation: I don't really understand what's it asking but I sort of did to get this answer!

5 0
3 years ago
What is network topology? PLZZZ HURRY
Mashcka [7]

Answer:

Network topology is the arrangement of the elements (links, nodes, etc.) of a communication network. Network topology can be used to define or describe the arrangement of various types of telecommunication networks, including command and control radio networks, industrial field busses and computer networks.

7 0
3 years ago
2. The On and Off states are represented by _____________ class 7 number system​
Artist 52 [7]

Answer:

Binary maybe, I think so

4 0
2 years ago
Read 2 more answers
Cyber security includes which of the following?
Law Incorporation [45]

Answer:

d. All of above

Explanation:

All answers are correct!

5 0
4 years ago
Other questions:
  • The largest country in South America
    7·1 answer
  • There are several methods of updating information and data on a webserver. We must consider who performs those updates upfront w
    9·2 answers
  • Your friend sends you a computer game. after installing the game on your computer, you realize that it plays very slowly. you kn
    14·1 answer
  • Wide area networks are defined by their ability to
    14·2 answers
  • Private sharing model on Opportunities. Leadership has asked the Administrator to create a new custom object that will track cus
    7·1 answer
  • Diligent people are as concerned with the ____ as the ___ of their work
    12·1 answer
  • Java code?????
    12·1 answer
  • This feature automatically creates tables of contents.
    5·1 answer
  • Jiz<br>Active<br>2<br>3<br>- 2(7 - 15)<br>What is the value of<br>4​
    10·2 answers
  • How would you describe binary to someone ??<br> PLEASE ANSWER I WILL GIVE U BRAINLY!!
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!