I am trying to understand this function and I don't get how at the bottom of the function that "vax(a,b)" can equal just a single integer.
once "b" equals zero then vax(a,b) somehow equals an integer.
I am in the learning phase of C++ and this is the first time I have seen that "abcde(int f,int g)" can equal an integer. Looking through my books I can see the form "abcde(int f, int g)" is brought up in something called "scope of names", but I don't understand it.
Code:
#include <iostream>
using namespace std;
int vax(int a, int b)
{
if(b == 0)
{
return a;
}
else
{
return vax(b, a % b);
}
}
int main()
{
int a,b;
cout << "Input first number: ";
cin >> a;
cout << "Input second number: ";
cin >> b;
cout << "Your number is:" << vax(a,b) << endl;
return 0;
}