Hello C++ forum!
I am working on a math research project and wanted to write a program in C++. My skills in C++ are decent, but not the best. I was writing my own code for the Euclidean Algorithm and when I output what is supposed to be the GCD I end up with some giant weird number thats the same every time. I gotta be missing something simple if no matter what the numbers are it outputs the same number. Any help would be awesome; Thanks!
Matt
[
#include <iostream>
To post code, use the code tags please, they are the ones to the right of the text box and look like this : "<>"
Your problem is not uncommon, a lot of people tend to do this
In main:
total = q1.calculate(total);
The arguement you gave to q1.calculate(int) is a bit recursive in a way in that you are trying to obtain a total, by giving the variable 'total' as an argument. If you don't yet have a value for argument 'total', there is no way it will magically insert a new value to total and calculate. And even if it does magically do this, there is no point in calculating it again seeing as you already have a total.
Solution:
My guess is that you are trying to add up the sum of argu1 and argu2, so a better way to call the function will be:
q1.calculate(argu1 + argu2)