Question: I'm receiving an error when I try to compile my code. Can I get some help? Error and code below! -------------------------------------------------------------------------------------------------------- #include using namespace std;
I'm receiving an error when I try to compile my code. Can I get some help? Error and code below!

--------------------------------------------------------------------------------------------------------
#include
using namespace std;
int GCD(int a,int b);
int main(){
/**
* Below two integer variables are declared named a and b.
*/
int a,b;
/**
* Below we prompt user to enter both values of a and b.
*/
cout
cin>>a>>b;
/**
* Below we call the function GCD of type int and pass the values a and b.
* Whatever the function returns, we store it in integer variable named answer.
*/
int answer=GCD(a,b);
/**
* Below we print the Output in required format.
*/
cout
return 0;
}
int GCD(int a,int b){
/**
* The function to calculate the Greatest Common Divisor, is actually
* the Euclid's GCD algorithm.
* It uses recursive approach to calculate the GCD.
*/
if(b==0){
/**
* Once the b parameter is 0 then we return first parameter as GCD.
*/
return a;
}else{
/**
* If both are not 0 then we Call GCD function recursively by passing
* b as first parameter
* and remainder of division a by b i.e a%b as second parameter.
*/
return GCD(b,a%b);
}
}
/tmp/ccLDzqlw.o: In function main' assignment1.cc:(.text+0x11): undefined reference to std: :cout' assignmentl.cc:(.text+0x16): undefined reference to std: :basic_ostream
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
