Topics
In Python, we can do simultaneous assignment without any temp variable like this:
a, b = b, a%bIn C++, we can achieve the same using std::tie and std::make_tuple, which are part of the C++ Standard Template Library (STL) (under <tuple> header).
// Simultaneously assigns b to a, and a%b to b
std::tie(a, b) = std::make_tuple(b, a % b);