int main(){
int miles;
do{ cout<<"Input your miles: "; cin >>miles; if (miles == 1.609){ cout<<"1 mile." <<endl; } else{ cout <<"\nDistance is " << convert(miles) << " km." <<endl; } }while(miles > 0) ; return(0); }
when i input 1.609 i get an infitine loop that continues until i manually close the program
What if you get rid of the If, and instead converting in Else, just Convert whatever the user inputs?
Besides, why are you using a loop? I think you just need to do the procedure once, you could use a loop when asking the user if he'd like to convert a different measure... Hmn?