Link to home
Start Free TrialLog in
Avatar of astroyboyy
astroyboyy

asked on

c++ code help

how do I read in a string from a file as a charactor array and then reverse the letters of each word ? e.g.

if the file contained :

This is a test
This is a test2

you would read in "This is a test" as a charactor array then reverse the letters to say "sihT si a tset" then read in the second line and reverse those letters as well.
ASKER CERTIFIED SOLUTION
Avatar of Answers2000
Answers2000

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
A C answer to a C++ question?  Duh...

STL makes the solution trivial.  Create a vector<string>, fill it using istream_iterators, use the for_each() function to invoke the reverse() function on all the strings in the vector.