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
Which are resources that a programmer might use? Select all that apply.
Hoochie [10]

Answer:

online help and user forums iam not sure of this amswer maybe

5 0
3 years ago
Read 2 more answers
Write the definition of a method, isReverse, whose two parameters are arrays of ints of equal size. The method returns true if a
jok3333 [9.3K]

Answer:

The following are code in the Java Programming Language.

//define boolean type function

boolean isReverse(int ar[], int b[])

{

//declare integer type variable

int x;

//set the for loop

for (x=0; x < ar.length && ar[x] == b[ar.length-1-x];  x++);

return x == ar.length;

}

Explanation:

<u>The following are the description of the code</u>.

In the above code that is written in the Java Programming Language, we define the boolean data type function that is 'is Reverse()' and pass two array integer data type arguments that is 'ar', 'b' in the then, declare integer data type variable that is 'x'. Set the for loop that the boolean type value is true or false.

5 0
3 years ago
What data unit is encapsulated inside a packet?
viva [34]

Answer: datagram

Explanation:

7 0
4 years ago
Read 2 more answers
The two objects representing values FALSE &amp; TRUE are called _________Integers​
scoundrel [369]

Answer:

true because I just had a test like this today and it put true and got it correct

5 0
3 years ago
​to add notes or comments, insert a comment tag using the syntax _____.
Aneli [31]
The needed syntax would be:
<!--comment-->
Hope I could be of assistance! ;)
4 0
4 years ago
Read 2 more answers
Other questions:
  • Pretrial services programs are also known as early intervention programs. <br> a. True <br> b. False
    15·1 answer
  • Your client expresses that they want their new website to have a responsivedesign with consistent coding. They are concerned wit
    5·1 answer
  • What kind of voltage do solar cells generate? Solar cells produce ______ voltage which is not usable by most household appliance
    15·1 answer
  • Can someone please help me with this question??
    12·1 answer
  • In the ADT graph the methid addVertex has efficiency
    15·1 answer
  • What conclusion did Freud reach when attempting to understand the connection between psychological and physical problems?
    12·1 answer
  • Which of these reduces friction and makes the job of moving a freezer easier?
    10·1 answer
  • You are going to buy a computer, but first you want to do some research to help you select the best model for your need. Where s
    12·2 answers
  • Write any two merits and demerits of computer​
    8·1 answer
  • Given an initialized variable fileName, write a sequence of statements that create a file whose name is given by the variable an
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!