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
lawyer [7]
3 years ago
14

Write a program that inputs a line of text and uses a stack object to print the line reversed.

Computers and Technology
1 answer:
Lina20 [59]3 years ago
8 0

Answer:

#include <bits/stdc++.h>

using namespace std;

int main() {

   string ms;

   getline(cin,ms);

   stack<char>st;

   for(int i=0;i<ms.length();i++)//Inserting every element in the stack..

   {

       st.push(ms[i]);

   }

   while(!st.empty()) //doing operation until the stack is not empty..

   {

       char a=st.top();//accessing the top element of the stack...

       st.pop();//removing the head.

       cout<<a;//printing the character..

   }

return 0;

}

Input:-

murder

Ouput:-

redrum

Explanation:

An  easy way to reverse anything is to use stack.Since stack is LIFO type data structure so the last item in will be the first one to get out hence it reverses the elements.So inserting every element of the string into the stack of characters and then printing the every element of the stack from top to bottom.

You might be interested in
What is a device that connects to the system unit and is controlled by the processor in the computer called !
Airida [17]
Most computers have three types of ports: serial, parallel, and USB. A serial port is a type of interface that connects a device to the system unit by transmitting data only one bit at a time. Serial ports usually connect devices that do not require fast data transmission rates, such as a mouse, keyboard, or modem.
4 0
3 years ago
Is the movie IT really that scary ? Rate between 1-10, 10 being I had nightmares
mezya [45]
5 I don’t think it’s good. I thought it was boring.
4 0
3 years ago
How does the use of cloud computing affect the scalability of a data warehouse? a. Cloud vendors are mostly based overseas where
zhenek [66]

Answer:

C. Hardware resources are dynamically allocated as use increases.

Explanation:

Cloud computing is a technique organisations to store and retrieve resources in a remote central database with secure access over the internet. It is able to access large data storage resources that would have cost more if they had implemented one for themselves.

A database or data centre is a online group of servers that is in a subscribed service to authorised users. Storage hardware allocation is dynamic to users, which means that another storage location in issued on every duration of subscription, making it easy to add more storage infrastructure. This defines the scalability of data centres.

4 0
3 years ago
Define storage device with two examples? ​
Vlad [161]

Answer:

Hehe!

Explanation:

Storage Device is a technology consisting of computer components and recording media that are used to retain digital data. It is a core function and fundamental component of computers. The central processing unit of a computer is what manipulates data by performing computations.

Examples: Hard disk and Floopy Disk.

7 0
2 years ago
Read 2 more answers
Toshiba Corporation makes computer chips. Toshiba Corporation would be classified as a A. merchandising company. B. manufacturin
solmaris [256]

Answer: Option 'B'

Explanation: They will be referred to as a manufacturing company because of they make the necessary part themselves not buy it from somewhere else.

5 0
3 years ago
Other questions:
  • Categorize the following relationships into generalization, aggregation, or association. Beware, there may be n-ary associations
    14·1 answer
  • Jana works in a call center helping people who are having trouble setting up their
    12·2 answers
  • The _________ contains frequently used formatting commands that are displayed when selecting text or objects with the mouse.
    7·1 answer
  • Once I install my secondary hard drive what two tasks need to be done?
    13·1 answer
  • Here's a thought: Why does your Brainly ranking keep going down?
    6·2 answers
  • A program written in a(n) procedural language consists of sequences of statements that manipulate data items. __________________
    9·1 answer
  • The picture that graphically represents the items you use in Windows is called a/an
    15·1 answer
  • Hiiiiiiiiiii hiiiiiiiiiiiiiiiiiii
    9·2 answers
  • Why is democracy the best form of government
    5·1 answer
  • IN C++
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!