Former Site Admin

**Posts:** 3809

**Joined:** 08 Jan 2009, 23:00

**Location:** California - Pacific Time (UTC -8/-7 Summer Time)

### Ben Goes back to C++

Anyway, I am making a simple program that uses Euclidian method for finding the GCD. Very simple, but I can't get my program to comile. It's a simple error, but my c skills are a bit rusty.

- Code:
`#include <iostream>`

using namespace std;

double greatestCommonDivisor(double first, double second);

int main ()

{

//variables

double first, second;

do

{

cout << "Welcome to Euclid's method for finding the GCD." << endl << "To quit, enter 0 for either number." << endl;

cout << "Enter the fist number:";

cin >> first;

cout << "Enter the second number:";

cin >> second;

greatestCommonDivisor(first, second);

}

while (first != 0 && second != 0);

return 0;

}

double greatestCommonDivisor(first, second)

{

if(second == 0) return first;

return greatestCommonDivisor(second, first % second);

}

I get the error:

gcdc.cpp: In function `int main()':

gcdc.cpp:30: error: expected `;' before '{' token

seems like a missing semicolen, but I don't see it.

Thanks guys.