Working on a program for the Euclidian algorithm, and it's giving me a bit of trouble. I think I have the math and such down, but it's giving me an unusual error. I believe I know what it's trying to tell me, but I can't figure out exactly what I've done wrong for the life of me!![]()
Ahem. My code so far (not complete, might I add)
The 17th line:Code:#include <iostream> using namespace std; void prompt(int&, int&); int gcf (int, int); int reduce (int, int); void main() { int num1 = 0; int num2 = 0; int gcf = 0; prompt (num1, num2); cout << "Fraction so far: " << num1 << "/" << num2 << endl; gcf (num1, num2); } void prompt(int &a, int &b) { cout << "Enter your numerator: "; cin >> a; cout << "Enter your denominator: "; cin >> b; } int gcf (int num1, int num2) { int remainder=1; int gcf; while (remainder!=0) { remainder=num1%num2; gcf=num2%remainder; } return gcf; }
is giving me trouble. As far as I know, it's correct for my purposes, but the compiler justi sn't happy with it. What have I missed?Code:gcf (num1, num2);



LinkBack URL
About LinkBacks




Back to the drawing board.