aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor McDowell <[email protected]>2024-02-09 15:28:14 -0800
committerConnor McDowell <[email protected]>2024-02-09 15:28:14 -0800
commit1ae8226772a6a1f519b08d3287de8914ce25b0a9 (patch)
tree479db8846abd519719b568aba85eb9fe0470e493
parentcreated user dob struct and functions (diff)
downloadhomework-4-connormcdowell275-1ae8226772a6a1f519b08d3287de8914ce25b0a9.tar.xz
homework-4-connormcdowell275-1ae8226772a6a1f519b08d3287de8914ce25b0a9.zip
re-organized existing functions and structs
-rw-r--r--Project1/Functions.cpp21
-rw-r--r--Project1/header.h8
-rw-r--r--Project1/program.cpp26
3 files changed, 29 insertions, 26 deletions
diff --git a/Project1/Functions.cpp b/Project1/Functions.cpp
index cb478ba..868ac8f 100644
--- a/Project1/Functions.cpp
+++ b/Project1/Functions.cpp
@@ -5,3 +5,24 @@ using std::cout;
using std::cin;
using std::endl;
+
+void printUser(userDoB newUser)
+{
+ cout << "User's birthday is: " << newUser.month << "/" << newUser.day << "/" << newUser.year << endl;
+}
+
+userDoB inputPersonal()
+{
+ userDoB user = {};
+
+ cout << "\n Please enter just the day you were born as a number: ";
+ cin >> user.day;
+
+ cout << "\n Please enter the month you were born as a number: ";
+ cin >> user.month;
+
+ cout << "\n Now please enter the year you were born as a number: ";
+ cin >> user.month;
+
+ return user;
+}
diff --git a/Project1/header.h b/Project1/header.h
index 6b81769..0530417 100644
--- a/Project1/header.h
+++ b/Project1/header.h
@@ -1,6 +1,13 @@
#ifndef HEADER
#define HEADER
+struct userDoB {
+ int month;
+ int day;
+ int year;
+};
+
+
int print100();
void printUser(userDoB newUser);
@@ -8,5 +15,4 @@ void printUser(userDoB newUser);
userDoB inputPersonal();
-
#endif HEADER \ No newline at end of file
diff --git a/Project1/program.cpp b/Project1/program.cpp
index 174cbf2..7646bad 100644
--- a/Project1/program.cpp
+++ b/Project1/program.cpp
@@ -11,11 +11,7 @@ using std::cin;
using std::endl;
// user info from lecture
-struct userDoB {
- int month;
- int day;
- int year;
-};
+
void main()
@@ -24,23 +20,3 @@ void main()
}
-void printUser(userDoB newUser)
-{
- cout << "User's birthday is: " << newUser.month << "/" << newUser.day << "/" << newUser.year << endl;
-}
-
-userDoB inputPersonal()
-{
- userDoB user = {};
-
- cout << "\n Please enter just the day you were born as a number: ";
- cin >> user.day;
-
- cout << "\n Please enter the month you were born as a number: ";
- cin >> user.month;
-
- cout << "\n Now please enter the year you were born as a number: ";
- cin >> user.month;
-
- return user;
-}