Reverse a string - c ++ program, C/C++ Programming

Assignment Help:

Reverse a string - C ++ program:

Write a program in c to reverse a string.

int main()

{

    Stack theStack;

    String reverse("reverse");

 

    cout << "\nEnter some strings.  Reverse will collect the strings\n";

    cout << "for you until you enter the string \"reverse\".  Reverse\n";

    cout << "will then print out the strings you have entered, but in\n";

    cout << "reverse order.  Begin entering strings now.\n";

 

    for(;;)

        {

        char inputString[255];

        cin >> inputString;

        String& newString = *( new String( inputString ) );

        if( newString != reverse )

            {

            theStack.push( newString );

            }

        else

            {

            break;

            }

        }

 

    cout << "\nThe strings you entered (if any) are:\n";

    while( !(theStack.isEmpty()) )

        {

        Object& oldString = theStack.pop();

        cout << oldString << "\n";

        delete &oldString;

        }

    return 0;

}


Related Discussions:- Reverse a string - c ++ program

Program of conversion from basic to user-defined variable, Conversion from ...

Conversion from Basic to User-Defined variable Consider the following example. class Distance                  {                   public  :

Explain protected derivation, Protected derivation In addition to doing...

Protected derivation In addition to doing private and public derivations, you may also do a protected derivation. In this situation :   The private members inherited

Boardcoloring, how to fill the blank space in4*4 matrix?

how to fill the blank space in4*4 matrix?

Net salary, please may i have a brief theory about a c++ program to find ne...

please may i have a brief theory about a c++ program to find net salary of employees

PADOVAN STRING, # c pragram TO count the number of occurances of the string...

# c pragram TO count the number of occurances of the string in nth padovan''s string program in java // aakash , suraj , prem sasi kumar kamaraj college program 1 : pa

Minimum shelf, At a shop of marbles, packs of marbles are prepared. Packets...

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

Create a programming system, Your task is to create a programming system fo...

Your task is to create a programming system for a ferry. The ferry transports passengers and vehicles (cars, busses, lorries and bicycles). The ferry has space for 200 passengers a

Described friend?, A: Something to let your class to grant access to anothe...

A: Something to let your class to grant access to another class or function. Friends may be either classes or functions. Class grants access privileges to its friends. In genera

Program of function overloading in c++ , Program of function overloading: ...

Program of function overloading: class vector{                 private :                 int v[3];                   public:                 /*friend istream &

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd