最近想用gcd(a, b)计算ab的最大公约数,结果遇到如下错误:

[Error] 'gcd' was not declared in this scope

解决方法

用的时候不要忘记了__
示例:

#include <cstdio>
#include <algorithm>
using namespace std;

int main(void)
{
	int a, b;
	scanf("%d%d", &a, &b);
	printf("%d\n", __gcd(a, b));
	return 0;
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-03
  • 2021-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
  • 2022-01-16
  • 2021-04-23
相关资源
相似解决方案