diff options
| author | Connor McDowell <[email protected]> | 2024-02-09 16:04:40 -0800 |
|---|---|---|
| committer | Connor McDowell <[email protected]> | 2024-02-09 16:04:40 -0800 |
| commit | 3cb4e3b20025fe6fad1bdb05030fbc51941dbbcf (patch) | |
| tree | 2dfbb6f40572dc56a4c9d29745b4f58cc8caa9a7 | |
| parent | re-organized existing functions and structs (diff) | |
| download | homework-4-connormcdowell275-3cb4e3b20025fe6fad1bdb05030fbc51941dbbcf.tar.xz homework-4-connormcdowell275-3cb4e3b20025fe6fad1bdb05030fbc51941dbbcf.zip | |
working on loops
| -rw-r--r-- | Project1/Functions.cpp | 7 | ||||
| -rw-r--r-- | Project1/header.h | 4 | ||||
| -rw-r--r-- | Project1/program.cpp | 52 |
3 files changed, 57 insertions, 6 deletions
diff --git a/Project1/Functions.cpp b/Project1/Functions.cpp index 868ac8f..f31aa9f 100644 --- a/Project1/Functions.cpp +++ b/Project1/Functions.cpp @@ -23,6 +23,11 @@ userDoB inputPersonal() cout << "\n Now please enter the year you were born as a number: "; cin >> user.month; - return user; } + +int Fishonacci() { + cout << "test" << endl; + + return 0; +} diff --git a/Project1/header.h b/Project1/header.h index 0530417..60d3344 100644 --- a/Project1/header.h +++ b/Project1/header.h @@ -7,12 +7,14 @@ struct userDoB { int year; }; - int print100(); void printUser(userDoB newUser); userDoB inputPersonal(); +// warframe reference. +int Fishonacci(); + #endif HEADER
\ No newline at end of file diff --git a/Project1/program.cpp b/Project1/program.cpp index 7646bad..3ac38af 100644 --- a/Project1/program.cpp +++ b/Project1/program.cpp @@ -10,13 +10,57 @@ using std::cout; using std::cin; using std::endl; -// user info from lecture - +void print100() { + int i = 0; + while (i < 101) { + cout << i << " "; + i++; + } +} -void main() +int main() { - userDoB newUser = inputPersonal(); + int i = 1; + while (i == 1) { + int t = 0; + cout << "Hello and welcome to the selection menu for Connor McDowell's CST116 homework assignment number 4" << endl; + cout << "Please enter a number from the selection below" << endl; + cout << "1: Print all integers from 0 to 100" << endl; + cout << "2: Input date of birth" << endl; + cout << "3: print the Fibonacci sequence up to an inputted term" << endl; + cout << "4: Exit the program" << endl; + cout << "Else will re-print this message!" << endl; + cin >> t; + if (t == 4) { + i = 0; + } + if (t != 1, 2, 3, 4) { + int main(); + } + if (t == 1) { + void print100(); + } + if (t == 2) { + int y; + userDoB inputPersonal(); + cout << "would you like to print your birthday? enter 1 for yes" << endl; + cin >> y; + if (y == 1) { + void printUser(); + } + else { + continue; + } + } + if (t == 3) { + int Fishonacci(); + } + } + + + + //userDoB newUser = inputPersonal(); } |