#include using namespace std; const int FINGERS_PER_PALM{4}; const int PALMS_PER_CUBIT{6}; const int GRAINS_PER_FINGER{1}; int main() { int inputCubits{0}, inputPalms{0}, inputFingers{0}; int fingers{0}, palms{0}, cubits{0}; int startFingers{0}, endFingers{0}; int totalFingers{0}; int rice{0}; // get the starting position cout << "Enter the starting cubits => "; cin >> inputCubits; cout << "Enter the starting palms => "; cin >> inputPalms; cout << "Enter the starting fingers => "; cin >> inputFingers; // convert that to fingers startFingers = inputFingers + inputPalms * FINGERS_PER_PALM + inputCubits * PALMS_PER_CUBIT * FINGERS_PER_PALM; // get the ending position cout << "Enter the ending cubits => "; cin >> inputCubits; cout << "Enter the ending palms => "; cin >> inputPalms; cout << "Enter the ending fingers => "; cin >> inputFingers; cout << endl << endl; // convert that to fingers endFingers = inputFingers + inputPalms * FINGERS_PER_PALM + inputCubits * PALMS_PER_CUBIT * FINGERS_PER_PALM; // find the totals totalFingers = endFingers - startFingers; rice = totalFingers * GRAINS_PER_FINGER; // convert start and print fingers = startFingers % FINGERS_PER_PALM; startFingers /= FINGERS_PER_PALM; palms = startFingers % PALMS_PER_CUBIT; cubits = startFingers / PALMS_PER_CUBIT; // print the starting information cout << "Nebi and Ako started at: " << cubits << " cubits " << palms << " palms " << fingers << " fingers " << endl; // convert end and print fingers = endFingers % FINGERS_PER_PALM; endFingers /= FINGERS_PER_PALM; palms = endFingers % PALMS_PER_CUBIT; cubits = endFingers / PALMS_PER_CUBIT; // print the starting information cout << " ended at: " << cubits << " cubits " << palms << " palms " << fingers << " fingers " << endl; // print the distance traveled fingers = totalFingers % FINGERS_PER_PALM; totalFingers /= FINGERS_PER_PALM; palms = totalFingers % PALMS_PER_CUBIT; cubits = totalFingers / PALMS_PER_CUBIT; cout << "Distance Traveled : " << cubits << " cubits " << palms << " palms " << fingers << " fingers " << endl; cout << "Total Rice: " << rice << " grains." << endl; return 0; }