both programs ran in the same time with VC++ 6.0 compiler in release mode on XP os. Maybe your compiler didn't optimize the code very well.