summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDouglas B. Rumbaugh <doug@douglasrumbaugh.com>2025-01-06 12:41:54 -0500
committerDouglas B. Rumbaugh <doug@douglasrumbaugh.com>2025-01-06 12:41:54 -0500
commitbd0772bb4a1950b3f438d7b9d8a82daac796f59d (patch)
treea8d53c02294beccdbf8df6074d2c8b03d63b8036 /include
parentb99427c3dc18e95f7ccecae07211511399d0ae5d (diff)
downloadmath-utils-bd0772bb4a1950b3f438d7b9d8a82daac796f59d.tar.gz
Added first version of a cumulative sum program
Diffstat (limited to 'include')
-rw-r--r--include/cumsum.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/cumsum.h b/include/cumsum.h
new file mode 100644
index 0000000..9761a08
--- /dev/null
+++ b/include/cumsum.h
@@ -0,0 +1,33 @@
+/*
+ */
+
+#ifndef H_CDF
+#define H_CDF
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <getopt.h>
+#include <string.h>
+#include <stdint.h>
+#include <assert.h>
+
+typedef union {
+ int64_t i;
+ uint64_t u;
+ double d;
+} Number;
+
+static int parse_options(int argc, char*const* argv);
+static void help();
+static int process_data(FILE *file);
+static void print_sum(Number sum);
+
+static int read_data_int(FILE *file, Number *num);
+static int read_data_uint(FILE *file, Number *num);
+static int read_data_fp(FILE *file, Number *num);
+
+#endif
+
+