How can I repair Windows XP without losing data?

Last Month, I formatted my PC because it was not functioning well. There was a virus entered on my computer and the best way to remove it is to reformat my PC. After formatting, when I am using it, there was a message appeared ant it said that there was a part of my local disk corrupted. Windows XP gave some solution to repair.
The solution was is to insert again the Windows XP CD and choose R to repair. I did it many times but unfortunately nothing happens.
