### Ben Goes back to C++

Posted:

**10 Oct 2016, 16:16**Before I make an account on a more appropriate forum, I figure I'll try my luck here (besides, I've found that forums are generally hostile towards new members with beginner questions...)

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.

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.

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.