1) Define a struct to store fractions like a/b where a is numerator and b is denominator and a and b are integers. Example: 1/2, 4/5, etc.. 2) Write a function which takes two fractions as input parameters and returns the sum of these fractions which is another fraction. For example: If the input fractions are 1/2 and 2/5, Then the function should return 9/10 as a fraction. If the input fractions are 1/4 and 2/4, Then the function should return 3/4 as a fraction. In general: a/b + c/d = (a + c) / b if b = d a/b + c/d = (ad + bc) / (bd) otherwise 3) In main function: - Take two fractions from the user. You need to get two integers from user for each fraction. - Send two fractions to your function and get the result returned from the function. - Print the result in a/b format.
1) Define a struct to store fractions like a/b where a is numerator and b is denominator and a and b are integers. Example: 1/2, 4/5, etc.. 2) Write a function which takes two fractions as input parameters and returns the sum of these fractions which is another fraction. For example: If the input fractions are 1/2 and 2/5, Then the function should return 9/10 as a fraction. If the input fractions are 1/4 and 2/4, Then the function should return 3/4 as a fraction. In general: a/b + c/d = (a + c) / b if b = d a/b + c/d = (ad + bc) / (bd) otherwise 3) In main function: - Take two fractions from the user. You need to get two integers from user for each fraction. - Send two fractions to your function and get the result returned from the function. - Print the result in a/b format.
1) Define a struct to store fractions like a/b where a is numerator and b is denominator and a and b are integers. Example: 1/2, 4/5, etc.. 2) Write a function which takes two fractions as input parameters and returns the sum of these fractions which is another fraction. For example: If the input fractions are 1/2 and 2/5, Then the function should return 9/10 as a fraction. If the input fractions are 1/4 and 2/4, Then the function should return 3/4 as a fraction. In general: a/b + c/d = (a + c) / b if b = d a/b + c/d = (ad + bc) / (bd) otherwise 3) In main function: - Take two fractions from the user. You need to get two integers from user for each fraction. - Send two fractions to your function and get the result returned from the function. - Print the result in a/b format.
1) Define a struct to store fractions like a/b where a is numerator and b is denominator and a and b are integers. Example: 1/2, 4/5, etc.. 2) Write a function which takes two fractions as input parameters and returns the sum of these fractions which is another fraction. For example: If the input fractions are 1/2 and 2/5, Then the function should return 9/10 as a fraction. If the input fractions are 1/4 and 2/4, Then the function should return 3/4 as a fraction. In general: a/b + c/d = (a + c) / b if b = d a/b + c/d = (ad + bc) / (bd) otherwise 3) In main function: - Take two fractions from the user. You need to get two integers from user for each fraction. - Send two fractions to your function and get the result returned from the function. - Print the result in a/b format.
Process by which instructions are given to a computer, software program, or application using code.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.