the purpose of the program is to add||subtract||multiply||divide fractions, everything works fine, but when it comes to the output.

The difference between the result of the operation and 1.00 (

diff=(1.00-result) is not displayed in fraction format that i intended

heres the code,

end of programCode:____________________________________________________ //---------------------------------------------------------------- cout<<"\n\n\a______________________________________________\n\n"; cout<<"\t\t"<<frac.oneFRAC<<"/"<<frac.twoFRAC<<" "<<oper<<" "<<frac.numTWO<<"/"<<frac.denomTWO<<" = "; if (result==three_quarter) cout<<"3/4"<<endl; else if (result==one_half) cout<<" 1/2"<<endl; else if (result==one_quarter) cout<<"1/4"<<endl; else if (result==seven_eights) cout<<"7/8"<<endl; else if (result==five_eights) cout<<"5/8"<<endl; else if (result==three_eights) cout<<"3/8"<<endl; else if (result==one_eight) cout<<"1/8"<<endl; else if (result==one_sixteen) cout<<"1/16"<<endl; else if (result==one_third) cout<<"1/3"<<endl; else if (result==two_third) cout<<"2/3"<<endl; else if(result==two_fifths) cout<<"2/5"<<endl; else if(result==one_tenths) cout<<"1/10"<<endl; else if(result==nine_tenths) cout<<"9/10"<<endl; else cout<<setprecision(3)<<setiosflags(ios::fixed|ios::showpoint)<<result<<endl<<endl; //---------------------------------------- cout<<" The difference from a whole (1.0) is:\n"<<endl; cout<<" 1.0 - "<<result<<" = "; { diff=1-result; if (diff==three_quarter) cout<<"3/4"<<endl; if (diff==one_half) cout<<" 1/2"<<endl; if (diff==one_quarter) cout<<"1/4"<<endl; if (diff==seven_eights) cout<<"7/8"<<endl; if (diff==five_eights) cout<<"5/8"<<endl; if (diff==three_eights) cout<<"3/8"<<endl; if (diff==one_eight) cout<<"1/8"<<endl; if (diff==one_sixteen) cout<<"1/16"<<endl; if (diff==one_third) cout<<"1/3"<<endl; if (diff==two_third) cout<<"2/3"<<endl; if(diff==two_fifths) cout<<"2/5"<<endl; if(diff==one_tenths) cout<<"1/10"<<endl; if(diff==nine_tenths) cout<<"9/10"<<endl; else cout<<diff<<endl<<endl; } //OUTPUT::__________________________________________ 1/2 + 2/5 = 0.900 The difference from a whole (1.0) is: 1.0 - 0.900 = 0.100 <<<<<THIS SHOULD BE 1/10 ______________________________________ Do you want to use the program again? (yes or no) >->:

__________________________________________________ __

THANK YOU FOR YOUR HELP

Fixed tags for you

-Govtcheez