aboutsummaryrefslogtreecommitdiff
path: root/mod_10a/source.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mod_10a/source.cpp')
-rw-r--r--mod_10a/source.cpp64
1 files changed, 63 insertions, 1 deletions
diff --git a/mod_10a/source.cpp b/mod_10a/source.cpp
index 3070d67..442b001 100644
--- a/mod_10a/source.cpp
+++ b/mod_10a/source.cpp
@@ -1,2 +1,64 @@
-source.cpp
+// created by till-t
+// 2-nov-2021
+// cst 116
+
+
+#include "source.h"
+
+
+ // get input for name
+
+void getName() {
+ char first[100]{0};
+ char last[100]{0};
+ cout << "Please enter your first name: ";
+ cin >> first;
+
+ cout << "Please enter your last name: ";
+ cin >> last;
+
+ cout << first << ", " << last;
+
+
+}
+
+
+
+/*
+
+char first[100];
+ char last[100];
+ char fullName[100];
+
+ // void getFirst(char&)
+ printf("Enter your first name: ");
+ scanf("%s", first);
+ while(getchar() != '\n'); // remove new line char
+
+ printf("Enter your last name: ");
+ scanf("%s", last);
+ while(getchar() != '\n'); // remove new line char
+
+ first[0] = toupper(first[0]);
+ last[0] = toupper(last[0]);
+
+ // Now, concat first and last
+ int i = 0;
+ int j = 0;
+ while(last[j] != '\0') {
+ fullName[i++] = last[j++];
+ }
+ fullName[i++] = ',';
+ fullName[i++] = ' ';
+
+ j = 0;
+ while(first[j] != '\0') {
+ fullName[i++] = first[j++];
+ }
+ fullName[i] = '\0';
+
+ printf("First name: %s\n", first);
+ printf("Last name: %s\n", last);
+ printf("Full name: %s\n", fullName);
+*/