int main(int argc, char *argv[]) { char programName[16]; snprintf(programName, sizeof(programName), "%s", argv[0]); if (argc == 1) { printf("[%s Syntax] : %s NUM\n", programName, programName); printf(" where NUM is a positive int\n"); return 0; } char arg1Buffer[21]; snprintf(arg1Buffer, sizeof(arg1Buffer), "%s", argv[1]); int n = atoi(arg1Buffer); char strFn[100]; // Did a patch job on implementing 2 modes; i.e. only check num arguments lol int mode = 0; // 0 -> Only want final val ; 1 -> Print all f(n) for n in [1,n] if (argc > 2) { mode =1; } getRational(n, strFn, mode); // Finds nth rational number, store as string in strFn printf("\n\n*** f(%d) = %s ***\n", n, strFn); return 0; }
inline Rational getValue(const byte* buf, ByteOrder byteOrder) { return getRational(buf, byteOrder); }