#include "libepc.h" typedef unsigned long int UNSIGNED32 ; typedef unsigned long long int UNSIGNED64 ; typedef struct TESTCASE { UNSIGNED64 dividend ; UNSIGNED32 divisor ; } TESTCASE ; UNSIGNED64 Quotient(UNSIGNED64 dividend, UNSIGNED32 divisor) ; void PutUNSIGNED64(UNSIGNED64) ; int main() { static TESTCASE tc[] = { {123456789012345678ll, 12345678l}, {876543210987654321ll, 87654321l}, {678901234567890123ll, 45678901l}, {321098765432109876ll, 10987654l} } ; int i, row, col ; ClearScreen(0x07) ; row = 5 ; col = 18 ; for (i = 0; i < ENTRIES(tc); i++) { UNSIGNED64 dividend, gccs, mine ; UNSIGNED32 divisor ; dividend = tc[i].dividend ; divisor = tc[i].divisor ; gccs = dividend / divisor ; mine = Quotient(dividend, divisor) ; SetCursorPosition(row++, col) ; PutString("Case #") ; PutUnsigned(i, 10, 0) ; PutString(": ") ; PutUNSIGNED64(dividend) ; PutString(" / ") ; PutUNSIGNED64((UNSIGNED64) divisor) ; SetCursorPosition(row++, col) ; PutString("gcc's Answer: ") ; PutUNSIGNED64(gccs) ; SetCursorPosition(row++, col) ; PutString(" My Answer: ") ; PutUNSIGNED64(mine) ; if (mine == gccs) PutString(" CORRECT!") ; else PutString(" Oops! Try again.") ; row++ ; } return 0 ; } void PutUNSIGNED64(UNSIGNED64 a) { if (a >= 10) PutUNSIGNED64(a / 10) ; PutChar('0' + (char) (a % 10)) ; }