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]
2 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]2 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
Buying a new computer for which of these reasons is most likely a sound
Svetllana [295]

Answer:

b. you need it to do your homework

Explanation:

3 0
2 years ago
Compare and contrast between Client/Server and Peer-to-Peer networks. What are some of the business benefits of using such netwo
fgiga [73]
Client/Server and Peer-to-Peer networks are the two major network architecture models in use today. They each have advantages and disadvantages that can be used to benefit a particular outcome.

Briefly, the client/server model relates to one or many client performing relatively simple requests, which are then executed by a server. The server is performing more complex tasks, and often interacting with many clients simultaneously. Examples of client/server models include most websites, including the Brainly page you are running right this instant. Your web browser is acting as a client, and the Brainly.com website is running as a web server. It receives simple requests or information from your browser, such as clicking on a question or text typed by your keyboard, and then acts on this information by consulting a database, returning values, or returning a whole new web page to your browser. The client/server model is very powerful in business as it allows powerful and secure server-side processing and relatively simple clients. Office 365 that runs all microsoft office suites such as word and excel in a web browser on 'the cloud' is an example of a highly sophisticated client/server architecture.

By contrast, peer-to-peer networks are a distributed architecture of equals. Instead of a simple client and complex server, all clients are equals and link together to form nodes on a distributed network. There is no central control (server) and each node acts as a client and server to other nodes. This is also an extremely powerful network; as there is no central control it is difficult to shut down a peer-to-peer network. Taking out one node will not break the network in comparison to the client/server architecture where if the server goes down, services halt. Prime examples of famous peer-to-peer networks are the Bitcoin network and similar cryptographic currency networks, and music and file sharing networks such as Torrents. The torrent tracker websites are client/server however once a torrent is loaded into a torrent downloading application, the file is collectively downloaded from hundreds of 'peers' across the world as part of the torrent peer-to-peer network.


3 0
3 years ago
The bank has a website that’s been attacked. The attacker utilized the login screen, and rather than entering proper login crede
RoseWind [281]

Answer:

C.SQL Injection

Explanation:

C.The text shown is the classic example of a basic SQL injection to log into a site

7 0
3 years ago
NEED HELP
valentina_108 [34]
It’s string. you can make the string bounce and make a sound.
7 0
3 years ago
Read 2 more answers
You approach a railroad crossing with a cross buck sign that has no lights or gates. What should you do?
dalvyx [7]
You should or must stop 50 feet away from it.
8 0
3 years ago
Read 2 more answers
Other questions:
  • Ideation includes all of the following EXCEPT
    5·1 answer
  • How have search engines like Google, Bing, and Yahoo! revolutionized the ability to do research? They are more difficult to acce
    15·2 answers
  • The java compiler requires that a source file use the ________ filename extension question 3 options: 1) .class 2) .h 3) .java
    8·1 answer
  • Which method can help you prevent RSI while using a keyboard?
    14·1 answer
  • python A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun
    15·2 answers
  • Which of the following is not a hazard a driver might encounter?
    5·1 answer
  • A researcher plans to identify each participant in a certain medical experiment with a code consisting of either a single letter
    10·1 answer
  • You can use a(n) to call a function in response to an event?
    14·1 answer
  • Explain the difference between file and folder (in your own words)
    6·1 answer
  • Ndcdeviceid?????????????????????​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!