displaying reverse of string input value without using any class library fuctiions
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: displaying reverse of string input value without using any class library fuctiions

  1. #1
    Join Date
    Feb 2015
    Posts
    11

    Question displaying reverse of string input value without using any class library fuctiions

    Someone please help me write a code which displays reverse of input(string) value without using any class library/builtIn functions.

    for example,

    String s= reverseString("hello");

    //I want to have this "hello" to be print out/output backwards. So we need to create a reverseString's function.

    Please help me with the rest, will appreciate it. Thank you.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,669

    Re: displaying reverse of string input value without using any class library fuctiion

    Turn the string into a character array, find the length and back your way through the string from the end to the beginning.

    When you get this coded, post the homework here if you need more help.

  3. #3
    Join Date
    Feb 2015
    Posts
    11

    Re: displaying reverse of string input value without using any class library fuctiion

    Thank you, ok so :
    String s= reverseString("hello");
    string reverse;
    int i, j;
    String reverseString(string str)
    {
    char[] c=new char[str.char()];
    for(int i=c.length-1, i>-1, i--)
    {
    reverse=j[i];
    return reverse;
    }
    console.writeline("Reverse of your input string is:" + j[i]);

    //I am not sure about this code, do not understand, please help

  4. #4
    Join Date
    Feb 2015
    Posts
    11

    Re: displaying reverse of string input value without using any class library fuctiion

    Quote Originally Posted by Arjay View Post
    Turn the string into a character array, find the length and back your way through the string from the end to the beginning.

    When you get this coded, post the homework here if you need more help.
    Arjay, I have posted my homework but not sure if I understood properly, the code needs to be improved, please help me in this, thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center