Recently, I find out about a special function in C ++: __gcd(A,B) . this will return the greatest common factor of A and B.
#include<iostream> #include<algorithm> using namespace std; main() { cout<<__gcd(10,40); //op: 10 }
Is there any special reason to start defining a function with 2 underscores?
It can be as simple as gcd(A,B) , like other STL functions.
source share