Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include // to be able to use operator typeid // Include the libraries and namespace statement that your program needs to compile here // Include

#include // to be able to use operator typeid

// Include the libraries and namespace statement that your program needs to compile here

// Include the function prototypes here. Define the functions below main()

// Ignore this; it's a little function used for making tests inline void _test(const char* expression, const char* file, int line) { cerr

int main() { // Start entering your code for main() here ----------------------------------------

// Stop entering your code for main() here ----------------------------------------

cout

// Do NOT remove or modify the following statements cout

AddRational(num, den, 1, 2, 2, 4); test(num == 1 && den == 1); // Incorrect addition of the fractions AddRational(num, den, 1, 3, 3, 4); test(num == 13 && den == 12); // Incorrect addition of the fractions AddRational(num, den, 9, 5, 2, 5); test(num == 11 && den == 5); // Incorrect addition of the fractions AddRational(num, den, 1, 3, 3, 18); test(num == 1 && den == 2); // Incorrect addition of the fractions AddRational(num, den, 1, 7, 3, 9); test(num == 10 && den == 21); // Incorrect addition of the fractions AddRational(num, den, 3, 7, 6, 9); test(num == 23 && den == 21); // Incorrect addition of the fractions

SubtractRational(num, den, 1, 2, 2, 4); test(num == 0 && den == 1); // Incorrect subtraction of the fractions SubtractRational(num, den, 1, 3, 3, 4); test(num == -5 && den == 12); // Incorrect subtraction of the fractions SubtractRational(num, den, 9, 5, 2, 5); test(num == 7 && den == 5); // Incorrect subtraction of the fractions SubtractRational(num, den, 1, 3, 3, 18); test(num == 1 && den == 6); // Incorrect subtraction of the fractions SubtractRational(num, den, 1, 1, 75, 12); test(num == -21 && den == 4); // Incorrect subtraction of the fractions SubtractRational(num, den, 6, 9, 3, 7); test(num == 5 && den == 21); // Incorrect subtraction of the fractions

pause(); cout

// Define your functions below this line please //---------------------------------------------

void pause() // This function pauses the execution of the program { cout

Void clear_screen() { cout

image text in transcribed
Euclid's algorithm: 1 let A and B be two positive integers (Hint: use abs () ) N let R = remainder after dividing A by B 3 while R != 0 A = B B = R R = remainder after dividing A by B 4 . B is the gof Example: suppose you need to reduce the fraction 24/60 First you find the gef of 24 and 60: A - 24, B - 60 24/60 is 0 with remainder R = 24 set A - 60, B - 24 60/24 is 2 with remainder R = 12 set A - 24, B - 12 24/12 is 2 with remainder R - 0 So, the gof is 12. Then, you need to divide 24 by 12 and 60 by 12 to get the fraction reduced. The resulting fraction is 2/5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions