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
Help me<br>please answers this questions<br>​
kobusy [5.1K]

Answer:

RSI stands for repeating similar movements

3 0
2 years ago
True or False? Any edition or version of Windows can join a domain.
Veseljchak [2.6K]

Answer: TRUE! 100%

If I was helpful i would to be rated brainliest please thank you!

Explanation:

8 0
2 years ago
Lets computer know what to do when it starts up...
Paha777 [63]

Answer: the answer would be the "Rom chip"

Explanation:

The rom chip controls all aspects of the computer, this is also known as "BIOS" or "basic input/output system"

5 0
3 years ago
What can be done in order to secure a WLAN/wireless access point?
polet [3.4K]

Answer:

this may help "Change default passwords. ...

Restrict access. ...

Encrypt the data on your network. ...

Protect your Service Set Identifier (SSID). ...

Install a firewall. ...

Maintain antivirus software. ...

Use file sharing with caution. ...

Keep your access point software patched and up to date."

Explanation:

4 0
3 years ago
Where is the BIOS for your computer located?
Ugo [173]
I believe the answer is C the motherboard!  
6 0
3 years ago
Other questions:
  • A Windows user contacted the help desk with a problem that requires the technician to connect to the remote computer using Remot
    12·1 answer
  • State 3 file formats explain them in an understanding manner apart from Microsoft word and PDF
    5·1 answer
  • How many generations of computer languages have there been since the middle of the 20th century?
    10·1 answer
  • Please debug the below code in Java please.
    15·1 answer
  • A program that will read each player’s name and golf score as keyboard input,
    9·1 answer
  • In batch operating system three job J1 J2 and J3 are submitted for execution each job involes an I/O activity a CPU time and ano
    13·1 answer
  • The cause of french revolution and anayze the reason for significane out come
    6·1 answer
  • Part of metacognition involves making a plan to address <br> .
    9·2 answers
  • What<br>are<br>the features of secondary storage media​
    13·2 answers
  • A company is looking for an employee to assign passwords to all of its
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!