Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

rational in c++ programming #ifndef _RATIONAL_H_ #define _RATIONAL_H_ #include using namespace std; class Rational { int_p; int_q; public: Rational(); Rational (int P, int Q =

rational in c++ programming
image text in transcribed
image text in transcribed
image text in transcribed
#ifndef _RATIONAL_H_ #define _RATIONAL_H_ #include using namespace std; class Rational { int_p; int_q; public: Rational(); Rational (int P, int Q = 1); void display() const; // _p:_9 void add(const Rational&); void sub(const Rational&); void mult(const Rational&); #endif In Rational.cpp, implement these member functions. You must make sure that you never have _qs zero[1]. Your Rational number must be stored in reduced form, that is, _p and _q must be relatively prime. You must not use any built-in functions In RationalMain.cpp, write a test main to test your code. Uvivu. UUUJIH, LULU PUU9 must be relatively prime. You must not use any built-in functions In RationalMain.cpp, write a test main to test your code. Submit these four files via the drop-box [1] _q cannot be zero for Rational numbers. We have added an additional constraint that _q must be greater than zero. This does not mean that a _g

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

More Books

Students also viewed these Databases questions

Question

What is operatiing system?

Answered: 1 week ago

Question

b. Explain how you initially felt about the communication.

Answered: 1 week ago