1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#include <stdio.h> #include "bunsuu2.h" int main() { try { _bunsuu2 b1(1, 4), b2(1, 6), b3(3, 4); b1.show(); printf(" + "); b2.show(); printf(" = "); (b1 + b2).show(); printf("\n"); b1.show(); printf(" + "); b3.show(); printf(" = "); (b1 + b3).show(); printf("\n"); b1.show(); printf(" + 1 = "); (b1 + 1).show(); printf("\n"); printf("2 + "); b2.show(); printf(" = "); (2 + b2).show(); printf("\n"); } catch (const char *msg) { printf("error: %s\n", msg); return 1; } return 0; }