Rational numbers P50688


Statement
 

pdf   zip   main.cc

thehtml

Define a rational type, to operate with rational numbers and implement the following operations:

rational zero (); rational fixa (int num, int den); int numerator (); int denominator (); rational sum (rational q1, rational q2); rational sub (rational q1, rational q2); rational mul (rational q1, rational q2); rational div (rational q1, rational q2); double real (rational q); void print (rational q);

Observation You only need to submit the required procedure; your main program will be ignored.

Information
Author
Jordi Petit
Language
English
Translator
Carlos Molina
Original language
Catalan
Other languages
Catalan
Official solutions
C++
User solutions
C++