aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Strapp <msattr@gmail.com>2020-09-15 13:16:09 -0500
committerMatthew Strapp <msattr@gmail.com>2020-09-15 13:16:09 -0500
commitccd82f53b74a1bac542d66eb7320fd2be5a9fd5a (patch)
tree35ae7abc6f9dcf44416511a1d4812263f34fab2d
parentadd gitignore (diff)
downloadhomework-ccd82f53b74a1bac542d66eb7320fd2be5a9fd5a.tar
homework-ccd82f53b74a1bac542d66eb7320fd2be5a9fd5a.tar.gz
homework-ccd82f53b74a1bac542d66eb7320fd2be5a9fd5a.tar.bz2
homework-ccd82f53b74a1bac542d66eb7320fd2be5a9fd5a.tar.lz
homework-ccd82f53b74a1bac542d66eb7320fd2be5a9fd5a.tar.xz
homework-ccd82f53b74a1bac542d66eb7320fd2be5a9fd5a.tar.zst
homework-ccd82f53b74a1bac542d66eb7320fd2be5a9fd5a.zip
add first breakout
-rw-r--r--csci4061/091420_breakout/Makefile16
-rw-r--r--csci4061/091420_breakout/address.c15
-rw-r--r--csci4061/091420_breakout/include/address.h6
-rw-r--r--csci4061/091420_breakout/include/main.h7
-rw-r--r--csci4061/091420_breakout/include/major.h6
-rw-r--r--csci4061/091420_breakout/include/name.h6
-rw-r--r--csci4061/091420_breakout/main.c36
-rw-r--r--csci4061/091420_breakout/major.c15
-rw-r--r--csci4061/091420_breakout/name.c8
9 files changed, 115 insertions, 0 deletions
diff --git a/csci4061/091420_breakout/Makefile b/csci4061/091420_breakout/Makefile
new file mode 100644
index 0000000..1e807a9
--- /dev/null
+++ b/csci4061/091420_breakout/Makefile
@@ -0,0 +1,16 @@
+CC=gcc
+CFLAGS=-I./include
+OBJ=main.o name.o address.o major.o
+EXE=w2.out
+
+all: $(EXE)
+
+$(EXE): $(OBJ)
+ $(CC) -o $@ $^ $(CFLAGS)
+
+%.o: %.c
+ $(CC) -c -o $@ $< $(CFLAGS)
+clean:
+ rm *.o $(EXE)
+run:
+ ./$(EXE) \ No newline at end of file
diff --git a/csci4061/091420_breakout/address.c b/csci4061/091420_breakout/address.c
new file mode 100644
index 0000000..3f36f70
--- /dev/null
+++ b/csci4061/091420_breakout/address.c
@@ -0,0 +1,15 @@
+#include "include/main.h"
+#include "include/address.h"
+
+/*
+ * Write getAddress function
+ * void getAddress(char * address);
+ * Prints a prompt "Enter your address: " to get an address,
+ * Reads in the user's address
+ */
+
+void getAddress(char * address) {
+ printf("Enter your address: ");
+ fgets(address, maxLen, stdin);
+ fflush(stdin);
+} \ No newline at end of file
diff --git a/csci4061/091420_breakout/include/address.h b/csci4061/091420_breakout/include/address.h
new file mode 100644
index 0000000..97a4c03
--- /dev/null
+++ b/csci4061/091420_breakout/include/address.h
@@ -0,0 +1,6 @@
+#ifndef INC_091420_BREAKOUT_ADDRESS_H
+#define INC_091420_BREAKOUT_ADDRESS_H
+
+void getAddress(char * address);
+
+#endif //INC_091420_BREAKOUT_ADDRESS_H
diff --git a/csci4061/091420_breakout/include/main.h b/csci4061/091420_breakout/include/main.h
new file mode 100644
index 0000000..6f7f6fe
--- /dev/null
+++ b/csci4061/091420_breakout/include/main.h
@@ -0,0 +1,7 @@
+#ifndef INC_091420_BREAKOUT_MAIN_H
+#define INC_091420_BREAKOUT_MAIN_H
+
+#include <stdio.h>
+static const int maxLen = 100;
+
+#endif //INC_091420_BREAKOUT_MAIN_H
diff --git a/csci4061/091420_breakout/include/major.h b/csci4061/091420_breakout/include/major.h
new file mode 100644
index 0000000..e649ea6
--- /dev/null
+++ b/csci4061/091420_breakout/include/major.h
@@ -0,0 +1,6 @@
+#ifndef INC_091420_BREAKOUT_MAJOR_H
+#define INC_091420_BREAKOUT_MAJOR_H
+
+void getMajor(char * major);
+
+#endif //INC_091420_BREAKOUT_MAJOR_H
diff --git a/csci4061/091420_breakout/include/name.h b/csci4061/091420_breakout/include/name.h
new file mode 100644
index 0000000..2bb96aa
--- /dev/null
+++ b/csci4061/091420_breakout/include/name.h
@@ -0,0 +1,6 @@
+#ifndef INC_091420_BREAKOUT_NAME_H
+#define INC_091420_BREAKOUT_NAME_H
+
+void getName(char * name);
+
+#endif //INC_091420_BREAKOUT_NAME_H
diff --git a/csci4061/091420_breakout/main.c b/csci4061/091420_breakout/main.c
new file mode 100644
index 0000000..aeb989e
--- /dev/null
+++ b/csci4061/091420_breakout/main.c
@@ -0,0 +1,36 @@
+/*
+ * Recitation section number:
+ * Breakout Group Number:
+ * Member name (email address):
+ * Member name (email address):
+ * Member name (email address):
+ * Member name (email address):
+ * Member name (email address):
+ * Member name (email address):
+ * Member name (email address):
+ */
+
+#include "include/main.h"
+#include "include/name.h"
+#include "include/address.h"
+#include "include/major.h"
+
+int main() {
+
+ char name[maxLen];
+ char address[maxLen];
+ char major[maxLen];
+
+ printf("Hi there! \nTell me more about you.\n");
+ getName(name);
+ getAddress(address);
+ getMajor(major);
+
+ printf("Thanks for your information!\n");
+ printf("Your name: %s", name);
+ printf("Your address: %s", address);
+ printf("Your major: %s", major);
+ printf("Bye!\n");
+
+ return 0;
+} \ No newline at end of file
diff --git a/csci4061/091420_breakout/major.c b/csci4061/091420_breakout/major.c
new file mode 100644
index 0000000..cfc9cef
--- /dev/null
+++ b/csci4061/091420_breakout/major.c
@@ -0,0 +1,15 @@
+#include "include/main.h"
+#include "include/major.h"
+
+/*
+ * Write getMajor function
+ * void getMajor(char * major);
+ * Prints a prompt "Enter your major: " to get an major,
+ * Reads in the user's major
+ */
+
+void getMajor(char * major) {
+ printf("Enter your major: ");
+ fgets(major, maxLen, stdin);
+ fflush(stdin);
+} \ No newline at end of file
diff --git a/csci4061/091420_breakout/name.c b/csci4061/091420_breakout/name.c
new file mode 100644
index 0000000..97c2a9d
--- /dev/null
+++ b/csci4061/091420_breakout/name.c
@@ -0,0 +1,8 @@
+#include "include/main.h"
+#include "include/name.h"
+
+void getName(char * name) {
+ printf("Enter your name: ");
+ fgets(name, maxLen, stdin);
+ fflush(stdin);
+} \ No newline at end of file