A PHP Error was encountered

Severity: Warning

Message: fopen(/tmp/ci_sessiond45eg6nu8qpf1pe58ch2t2f31enh6hsl): failed to open stream: No space left on device

Filename: drivers/Session_files_driver.php

Line Number: 176

Backtrace:

File: /var/www/html/application/controllers/Project.php
Line: 10
Function: __construct

File: /var/www/html/index.php
Line: 311
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_start(): Failed to read session data: user (path: /tmp)

Filename: Session/Session.php

Line Number: 143

Backtrace:

File: /var/www/html/application/controllers/Project.php
Line: 10
Function: __construct

File: /var/www/html/index.php
Line: 311
Function: require_once

Reverse of a String using stack in C++ | kamayaniR
Coders Packet

Reverse of a String using stack in C++

By kamayani

  • stringreverse_stack.sln
  • resverse string.txt
  • In this C++code, we can easily reverse a string using the stacks. once the input is given, it gives the output string in the reverse format.

    STEPS-
    1) Create an empty stack.
    2) One by one push all characters of string to stack.
    3) One by one pop all characters from stack and put them back to string.

    CODE-

    #include 
    #include 
    #include 
    #include 
    
    
    using namespace std;
    
    int main()
    {
        int i=0;
        string text;
        stack s;
        cout<<"Enter a string you want reverse of: ";
        cin>>text;
        for(int i=0;i<text.length();i++)
        {
            s.push(text[i]);
        }
        while(!s.empty())
        {
            cout<<s.top();
            s.pop();
        }
    }

     

    OUTPUT-

     

     

    Download Complete Code

    Comments

    No comments yet

    Download Packet

    Reviews Report

    Submitted by kamayani (kamayaniR)

    Download packets of source code on Coders Packet