That's exactly what the problem is the xp and xv is not updating. for the program to work xv and xp must update. initially xv and xp is given but I want to update it throughout the program and I can'nt seem to do that. About the comparision I think it is right and "ssharish2005" if you think I made a mistake please point it out where I'am open to criticism I consider it as free feedback. Please point out to me how to update the values of xv and xp i think this is where i'am making my mistake.