Page 1 of 1

5. Write a full program to include the necessary-preprocessor directives, the function prototypes, the main function, an

Posted: Fri May 20, 2022 2:50 pm
by answerhappygod
5 Write A Full Program To Include The Necessary Preprocessor Directives The Function Prototypes The Main Function An 1
5 Write A Full Program To Include The Necessary Preprocessor Directives The Function Prototypes The Main Function An 1 (23.61 KiB) Viewed 43 times
5. Write a full program to include the necessary-preprocessor directives, the function prototypes, the main function, and the function calls to the defined functions in questions 3 and 4. To properly call the previously listed functions, the main function must declare integer array of size 8, an input file stream, and three instances of FractionType (fracl, frac2, and frac3). Include code to initialize the integer array with values from a file. Initialize the frac1 and frac2 instances with values from a file. Remember to print the contents of all array structures and Fractiontype instances after initialization to the console. Be sure to call the above listed functions properly with the appropriate parameters. If the denominator of any of Fraction Type objects are zero, display the message: "Cannot perform operation!" to the console. Otherwise, display the results of the add function call to the console. (30pts) Attach the code and screenshot of a successful run on the program.

3. Write a driver function definition called add that takes as its parameters two FractionType objects. The driver function should add two fractions together and return a FractionType object. Remember that the denominators of fractions cannot be 0. (Hint: validate each fraction before performing the addition operation. Also, do not to reduce the FractionType object to its simplest form.) (15pts) *PASTE CODE HERE*/ 4. Write a function called findMinMax that takes a integer array, integer reference to the minimum value, integer reference to the maximum value, and its size as parameters. The function should find both the minimum and maximum values in the integer array. Return the minimum and maximum values back to the calling function. (15pts) *PASTE GODE HERF*/