Ashieboy
Member level 1
Write a program that accepts from the user two fractions Fraction1
and Fraction2; display them, then asks the user the arithmetic
operation to be performed on the two fractions, either addition (+)
or subtraction (-).
The program uses the following functions to accomplish the tasks
above:
a) inputfrac: This function accepts from the user four numbers n1, d1, n2 and d2; then
return it to the main program.
b) fraction: This function is a void function that accept the two fractions using pass by
value method and then display the two fractions on to the monitor.
c) addfrac: This function is a void function that accept the two fractions using pass by
value method, calculates and display their sum. Optional: The result must be in its
simplest fraction form.
d) subfrac: This function accept the two fractions using pass by address method, find
and return their difference to the main() program. The main program then display
the difference. Optional: The result must be in its simplest fraction form.
These functions must be called from the main() program.
and Fraction2; display them, then asks the user the arithmetic
operation to be performed on the two fractions, either addition (+)
or subtraction (-).
The program uses the following functions to accomplish the tasks
above:
a) inputfrac: This function accepts from the user four numbers n1, d1, n2 and d2; then
return it to the main program.
b) fraction: This function is a void function that accept the two fractions using pass by
value method and then display the two fractions on to the monitor.
c) addfrac: This function is a void function that accept the two fractions using pass by
value method, calculates and display their sum. Optional: The result must be in its
simplest fraction form.
d) subfrac: This function accept the two fractions using pass by address method, find
and return their difference to the main() program. The main program then display
the difference. Optional: The result must be in its simplest fraction form.
These functions must be called from the main() program.