String Transposition

Hello,
I am working on a project where if need to compare a multiple strings from a file and it needs to compare the first word with the following words on the line. I need to compare the strings and find out if two characters positions are swap within the string and then output what it is. I have found all the other possibilities that I need, but I unable to figure out this one. If anyone has any ideas it would be greatly appreciated. (A transposition example would be Their and Thier)
Heres a sample that i have to read from
1
2
3
COMPUTER  COMPUDER  COPMUTER COMPTER COMPUTXER KOMPUTERS COMPUTER
BRITNEY BRITTANY  BRITNE  BRITNYE  BTITINEY  BRITNEYS
KOURNIKOVA   KOURNIKOVO OURNIKOVA  OKURNIKOVA SKOURNIKOVA COURNIKOVA KOURNAKOVA
Last edited on
I think a solution might me: read all the strings and memorize them in an array of strings (char*) and then to compare them with an inbricated loop. You can read them from the file in a while loop with the condition: while(!fin.eof()). The fgets function should work properly.
Topic archived. No new replies allowed.