I need a simple program that converts a user entered decimal into a fraction in C++ format.
The program will first prompt for and accept the decimal fraction. It must be between 0 and 1. If the user enters a number not between 0 and 1 it should repromt the user and reaccept a value.
Next ask a user for a denominator of the fraction they want to use. An integer between 2 & 300. If the user enters a number not between 2 and 300 it should repromt the user and reaccept a value.
Now I need a loop to try all the fractions with the desired denominator and remember the best one. For example, if the user enters 5 as the denominator, and .55 as the decimal fraction, the loop will calculate 1/5, 2/5, 3/5, 4/5, and 5/5. It will compare each to the desired value of .55 and, for each, will decide if the new value is better than the previous best value. Now it should try to reduce the fraction if at all possible.
Lastly it should prompt the user, and ask if they would like to try another decimal.
I would like each part to be done in separate functions. This should be a fairly easy program and would like it done very basically with nothing fancy
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Installation package that will install the software (in ready-to-run condition) on the platform(s) specified in this bid request.
3) Exclusive and complete copyrights to all work purchased. (No GPL, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site).