The Diamonds 15 Newbie Poster

Hi,

I can't see how your code would work, I think you've missed couple of somethings.

As I saw on many websites, you need to use the function "ssh2_exec" instead of "exec" and you need to run the commands one by one.

Also, in your case you can't use the command:

$progress=mysql_affected_rows(); // line 38

because you're not managing the mysql connection by php.

For more info about ssh connection try this link and search for "Great! PHP supports SSH - time to code" to skip server configurations.

The Diamonds 15 Newbie Poster

Thanks Dani for posting your solution :)

I found the same approach but with the use of hooks to register this function on "pre_system" here

The Diamonds 15 Newbie Poster

Hi,

The issue that you're facing is not a logical error in your "Fraction" class, it is just you didn't print the values properly.

Look at line 20 of your code:

Console.WriteLine(" + {0} {1}/{2} = {3} {4}/{5}", secondfraction.WholeNumber, secondfraction.Numerator,secondfraction.WholeNumber, add.WholeNumber, add.Numerator, add.Denominator);

you print secondfraction.WholeNumber in field {2} instead of secondfraction.Denominator.. so the real number is (2 1/8) but you're printing it (2 1/2) and nothing wrong in the result (2 3/8)

Just change that line to:

Console.WriteLine(" + {0} {1}/{2} = {3} {4}/{5}", secondfraction.WholeNumber, secondfraction.Numerator, secondfraction.Denominator, add.WholeNumber, add.Numerator, add.Denominator);

Note: I didn't review all of your code.. I just checked that problem.

Good Luck!

ddanbe commented: Great help! +15