Is it possible to get both the modulus and quotient of division in a single operation in C++?

Yes, the compiler will do it for you. Just use a divide followed by a remainder with the same operands.
https://godbolt.org/z/oK4f4s

void div(int n, int d, int *q, int *r)
{
    *q = n / d;
    *r = n % d;
}

div(int, int, int*, int*):
        mov     eax, edi
        mov     r8, rdx
        cdq
        idiv    esi
        mov     DWORD PTR [r8], eax
        mov     DWORD PTR [rcx], edx
        ret

Is it possible to get both in a single operation?

No, there is no such operator in C++. There is function in the standard library which does both operations: std::div

But this doesn't matter. Whether you have one or two operations in C++ doesn't mean that the cpu would have to perform that many operations. A half decent optimiser will be able to translate both operations into a single instruction (assuming that is possible with the target CPU).


Yes. That's what the functions std::remquo and std::div do.