2. The number of scores to be processed, the numerator and denominator of the scores to be processed, and the operation of specific work are all input through the keyboard, and the input is finished by inputting the keyboard.
3. The returned result is given in the form of the simplest fraction, decimal or integer.
Second, the design ideas:
1. We write fractions as a class, use corresponding data members to represent numerator and denominator, and use corresponding functions to complete various needed operations.
2. If a fraction is processed, the simplest fraction and decimal result of the processing result are returned (the decimal part is all zero and the integer part is returned); If four operations are performed on two fractions, the simplest fraction and decimal result of the calculation result are returned (integers with zero decimal parts are returned).
3. If the score to be processed is 1, there are three different member functions to complete the reduction, square root and square of the input score respectively; If you want to deal with two fractions, there are four different friend functions to complete the sum, difference, quadrature and quotient operations of the two fractions.
4. Because the greatest common divisor and the least common multiple of two numbers are often found in member functions, two global functions are specially written to find the greatest common divisor and the least common multiple of two numbers.
Third, the use of documents:
After the program runs, read the prompt information carefully to understand the function of the program, and then complete the following operations according to the prompt information: 1, first enter the number of scores you want to process, and then press enter; 2. Enter the numerator and denominator of the fraction you want to deal with in turn (because the choice made in the first step is different, there may be one or two fractions, but only integers can be entered), and then press enter; 3. According to the prompt, enter letters to select the operation to be performed (only letters can be entered), and then press enter; 4. In the process of input, if there is an input error (for example, the denominator of the input is zero, or the numerator of the input dividend is zero during the division operation), a prompt statement will appear to prompt re-input to obtain the correct input result.