Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#include #include #include fractionType.h using namespace std; int main() { fractionType num1(5, 6); //Line 1 fractionType num2; //Line 2 fractionType num3; //Line 3 cout cout
#include
#include
#include "fractionType.h"
using namespace std;
int main()
{
fractionType num1(5, 6); //Line 1
fractionType num2; //Line 2
fractionType num3; //Line 3
cout
cout
cout
cout
cout
cout
cin >> num2; //Line 10
cout
cout
//Line 12
num3 = num1 + num2; //Line 13
cout
cout
cout
num3 = num1 - num2; //Line 17
cout
cout
cout
cout
cout
cout = ("
= num2)
cout
cout ("
num2) x should store 2/3 in x The statement: cout
cout
Problem Description: (30 marks) Task-1: Rational fractions are of the form a /b, in which a and b are integers and b 0. In this exercise, by fractions" we mean rational fractions. Suppose a/b andc/dare fractions. Arithmetic operations and relational operations on fractions are defined by the following rules: Arithmetic Operations: a/b tcld-(ad+bc)/bd (a/b)/(c/d)-adbe, in which cel #0 Relational Operations: (abs-cia)- (ad-be) (ab-c/d) = (ad-bc) Fractions are compared as follows: a/b op c / d if ad op bc, in which op is any of the relational operations. For example, a/b return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started