1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Rep Power

    Unhappy Switching characters in a string

    I am new to C++. I bought a book to learn C++.

    How do you switch characters in a string?

    For example in an input file,


    lloje jello
    tba bat
    usegro grouse
    grammingtele telegramming

    I want to read all 4 rows of text, switch the characters in the left until it matches the text in the right.

    I want the output to look like this and continue to read the next row of strings? I want to use the string library supplied by the STL.

    usegro -> segrou -> egrous -> grouse
  2. #2
  3. I'm Baaaaaaack!
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jul 2003
    Rep Power
    Look around, there are already posts on this.

    My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
    Free code: http://sol-biotech.com/code/.
    Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
    Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
    LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw

IMN logo majestic logo threadwatch logo seochat tools logo