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

Car rental project, I need a project on car rental system using c programmi...

I need a project on car rental system using c programming only of college level

Need ftp upload and mysql, Need FTP Upload and MySQL Project Description...

Need FTP Upload and MySQL Project Description: We are in need of an executable application that will be execute as a scheduled task on Windows Server 2008 R2 and can perform

Area under curve, Write a program to find the area under the curve y = f(x)...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Program to access file system, The program must use the file named on the c...

The program must use the file named on the command line as its input file. Suppose the program is named pdbtool. Then if the user types pdbtool 1A36.pdb the program must read the d

Area under curve, Write a program to find the area under the curve y = f(x)...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b.     #include float start

Friend function, Ask question #Minimum 100 what is friend function is used ...

Ask question #Minimum 100 what is friend function is used in c++

Array, If an array holds integer, each of which is four bytes long, how man...

If an array holds integer, each of which is four bytes long, how many bytes from the base location of the array is the location of the fifth element?

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