Okay, so I am super new to programming and our assignment for my class is to write a program that calculates the greatest common divisor but the first number entered by the user must be less than the second number. I wrote my code but when I go to compile it I am given the error message "expected initializer before "do"". I have tried tweaking everything I can think of to get rid of this error message but nothing seems to work. I was hoping someone would be able to point out the error I made that is causing this. (Note: I've tried googling this but nothing I've found has been of any use).
#include <iostream>
#include <cmath>
usingnamespace std;
int gcd(int x, int y) {
return y == 0 ? x : gcd(y, x % y);
}
int main()
do {
cout << "Enter first number: ";
cin >> x;
cout << "Enter second number: ";
cin >> y;
if (x < y)
cout << "Please enter a number larger than the first number.";
returnifelse (x > y)
cout << "Greatest Common Divisor: " << gcd(abs(x), abs(y)) << endl;
}