Computer Science Canada Fraction Program Using A Data File |
Author: | phuong [ Thu Jun 02, 2005 11:21 am ] |
Post subject: | Fraction Program Using A Data File |
check out my fractions program. it reads the fractions from a data file and performs operations on them. the program also puts the fractions into lowest terms and into mixed fraction form. tell me what you think. ^^ the data file is set up as follows: operator numerator1 denominator1 numerator2 denominator2 |
Author: | jamonathin [ Wed Jun 08, 2005 11:28 am ] |
Post subject: | |
After the data is 'sucessfully loaded', an error pops up. Take a look at it. Quote: Line 96 Division (or modulus) by zero in Integer expression. |
Author: | MysticVegeta [ Sun Jun 26, 2005 9:13 am ] | ||
Post subject: | |||
How about my fraction program: Instructions are there in the source:
|
Author: | Cervantes [ Sun Jun 26, 2005 10:15 am ] | ||
Post subject: | |||
You could save yourself some lines in your code, Mystic, by removing the ans variable from your LCM and Reduce functions. Instead of storing the answer into a variable and then resulting that, just result the answer.
Also, mixed fractions are ugly. Improper fractions are the way to go. ![]() |
Author: | AsianSensation [ Sun Jun 26, 2005 10:28 am ] | ||
Post subject: | |||
Here is Euclid's algorithm, it finds the GCD of 2 different numbers.
I think it's a bit better as the reducing function. |