#include "Utils.hpp" #include #include using namespace std; int main(int argc, char **argv) { int const a = 326; int const b = -1; int const c = 2015; long const i1 = 65000; long const i2 = -2; long const i3 = 3261963; double const f1 = 3.1415926; double const f2 = 2.99792458e9; double const f3 = 1.234e-4; int const c1 = int('A'); int const c2 = int('B'); int const c3 = int('C'); string const s1 = "Apples"; string const s2 = "and"; string const s3 = "Bananas"; bool const b1 = true; bool const b2 = false; string s; s = Utils::sprintf("Decimals: %d %d %d", a, b, c); cout << s << endl; s = Utils::sprintf("Unsigned Decimals: %u %u %u", a, b, c); cout << s << endl; s = Utils::sprintf("Hexadecimals: %#x %#x %#x", a, b, c); cout << s << endl; s = Utils::sprintf("Long Decimals: %ld %ld %ld", i1, i2, i3); cout << s << endl; s = Utils::sprintf("Long Hexadecimals: %016lx %016lx %016lx", i1, i2, i3); cout << s << endl; s = Utils::sprintf("Fixed FP: %f %f %f", f1, f2, f3); cout << s << endl; s = Utils::sprintf("Exponential FP: %e %e %e", f1, f2, f3); cout << s << endl; s = Utils::sprintf("General FP: %g %g %g", f1, f2, f3); cout << s << endl; s = Utils::sprintf("General FP with precision: %.2g %.2g %.2g", f1, f2, f3); cout << s << endl; s = Utils::sprintf("Boolean: %d %d", b1, b2); cout << s << endl; s = Utils::sprintf("Character: %c %c %c", c1, c2, c3); cout << s << endl; s = Utils::sprintf("String: %s %s %s", s1.c_str(), s2.c_str(), s3.c_str()); cout << s << endl; return 0; }