Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++ Calculations using bool

Name: Anonymous 2012-03-06 11:13

A useful technique for performing high precision math is to represent numbers as rationals, that is by the ratio of two integers. In this assignment you will implement the four functions described below, which provide the basic calculation operations on rational numbers. The functions you are to implement are as follows:

bool ratAdd(int ln, int ld, int rn, int rd, int& on, int& od)
Addition of the rational numbers.

bool ratSub(int ln, int ld, int rn, int rd, int& on, int& od)
Subtraction of the rational numbers.

bool ratMult(int ln, int ld, int rn, int rd, int& on, int& od)
Multiplication of the rational numbers.

bool ratDiv(int ln, int ld, int rn, int rd, int& on, int& od)
Division of the rational numbers.

In all cases:
ln/ld and rn/rd are the left and right operand, respectively,
on/od is the result, which must be expressed in lowest terms, and
the returned value is false if and only if a denominator is 0.


This is another programming assignment of mine, have no idea how i would even start! Any help is appreciated!

Name: Anonymous 2012-10-27 12:16

Why return bool? Doesn't it make more sense to... return the value you're calculating?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List