Take two integers, return the quotient and remainder, divmod
// Take two integers, return the quotient and remainder
#include <iostream>
using namespace std;
auto divmod(int dividend, int divisor) {
struct result {int quotient; int remainder;};
return result {dividend / divisor, dividend % divisor};
}
int main() {
auto result = divmod(14, 3);
cout << result.quotient << ", " << result.remainder << endl;
// or
auto [quotient, remainder] = divmod(14, 3);
cout << quotient << ", " << remainder << endl;
}