write the progaram by using concept of class to find the greatest diviser of two number. in C++
Share
write the progaram by using concept of class to find the greatest diviser of two number. in C++
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Verified answer
In the current draft of what will (almost certainly) soon become C++20, the standard library has added function templates for both `gcd` and `lcm`. So, with a compiler that implements these, you no longer have to write the function yourself, just call the one in the library:
#include <numeric>
#include <iostream>
As I write this (30 Jan, 2019) the only compiler I have handy that includes this recent addition is Microsoft’s Visual Studio 2019 Preview—but if I had more up to date copies of Clang and gcc, they probably support it already as well.
Answer:
In the current draft of what will (almost certainly) soon become C++20, the standard library has added function templates for both gcd` and `Icm`. So, with a compiler that implements these, you no longer have to write the function yourself, just call the one in the library:
#include <numeric>
#include <iostream>
As I write this (30 Jan, 2019) the only compiler I have handy that includes this recent addition is Microsoft's Visual Studio 2019 Preview-but if I had more up to date copies of Clang and gcc, they probably support it already as well.