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

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";




        char inputString[255];

        cin >> inputString;

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

        if( newString != reverse )


            theStack.push( newString );








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

    while( !(theStack.isEmpty()) )


        Object& oldString = theStack.pop();

        cout << oldString << "\n";

        delete &oldString;


    return 0;


Posted Date: 10/19/2012 3:05:23 AM | Location : United States

Related Discussions:- Reverse a string - c ++ program, Assignment Help, Ask Question on Reverse a string - c ++ program, Get Answer, Expert's Help, Reverse a string - c ++ program Discussions

Write discussion on Reverse a string - c ++ program
Your posts are moderated
Related Questions
How does free know the size of memory to be deleted.? int *i = (int *)malloc(12); followed by free(i); how did free function call know how much of memory to delete? A: It bas

Create a class  called  ticketSelling that stores booking information of a single performance on a single day and sells the tickets of the performance. The class should include at

Integer literal Integer is numbers without fractional parts. e.g. 20       // Decimal 024      // Octal     0x14     // Hexadecimal To indicate long, unsigned,

I''m trying to write a function that prints the substring if it is found in the string, and after it prints it deletes it from the string so i could print the next substring if it

Objective of this Program: (a) To learn more about modularization of a program into independent modules, (b) To use arrays in a program, (c) To get some experience with us

write a prgm to find minimum total number of shelves including the intial one required for loading process

Given an char variable last that has been initialized to a lowercase letter, write a loop that displays all possible combinations of two letters in the range ''a'' through last. Th

obtain two numbers from thekey board,and determain and display(if either)is the larger of two numbers.

Write a program to process bank accounts. Create a base class named Account and two derived classes named Savings and Checking. In the base class, use an int AccountNum and a dou

how to create a shopping cart