From 49d4392ca1972c8d66b1015f2cdda414d94812b8 Mon Sep 17 00:00:00 2001 From: Mitsuo Tokumori Date: Fri, 18 Aug 2023 01:56:52 -0500 Subject: Fix naming. Add leading 0 to lab names --- 2022-2/L01/mitsuo/aux.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 2022-2/L01/mitsuo/aux.h (limited to '2022-2/L01/mitsuo/aux.h') diff --git a/2022-2/L01/mitsuo/aux.h b/2022-2/L01/mitsuo/aux.h new file mode 100644 index 0000000..ceb1ff3 --- /dev/null +++ b/2022-2/L01/mitsuo/aux.h @@ -0,0 +1,30 @@ +/* Stream manipulator macros + * ========================= */ + +// The parenthesis in C/C++ macros are best practice +// https://stackoverflow.com/q/7186504/7498073 + +// string +// (add space in front to separate adjacent right-aligned and left-aligned +// fields) +#define WL(w) " " << setw((w)-1) << left << setprecision(2) << fixed + +// number +#define WR(w) setw(w) << right << setprecision(2) << fixed + +// number with some 0-padding part (e.g., a code) +#define WR0(w, w0, x) setw((w) - (w0)) << "" \ + << setw(w0) << right << setfill('0') \ + << setprecision(2) << fixed << (x) \ + << setfill(' ') + + +/* Project definitions */ + +#define MAXLEN 100 // fixed length strings + + +/* Function declarations */ + +int readdate(std::istream &is); +void writedate(std::ostream &os, int intdate); -- cgit v1.2.3