aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Taormina <[email protected]>2021-11-10 00:55:03 -0800
committerTyler Taormina <[email protected]>2021-11-10 00:55:03 -0800
commitc9bae16c18dada53af769de575f9da0a3dc006ae (patch)
treed815f82fd4b2f390e2c2704fa21da0f88733a31d
parentCompleted modules 11a and 11b. (diff)
downloadcst116-lab6-till-t-c9bae16c18dada53af769de575f9da0a3dc006ae.tar.xz
cst116-lab6-till-t-c9bae16c18dada53af769de575f9da0a3dc006ae.zip
Daily edit for lab.
Need to work on cStrings and the last three functions. Frame is built but functionality needs to be added.
-rw-r--r--mod11c.cpp121
1 files changed, 121 insertions, 0 deletions
diff --git a/mod11c.cpp b/mod11c.cpp
new file mode 100644
index 0000000..be91372
--- /dev/null
+++ b/mod11c.cpp
@@ -0,0 +1,121 @@
+// Tyler Taormina
+// CST 116
+// Module 11c
+//
+
+#include <iostream>
+#include <iomanip>
+
+using namespace std;
+
+void isPalindrome(string);
+void isAlpha(string);
+void countChar(string);
+void getData(string&);
+void DisplayMenu(int&);
+void processChoice(int, string);
+
+int main() {
+ string user_string;
+ int user_choice;
+
+ cout << "=================================================================" << endl;
+ cout << "PROGRAM RUNNING.." << endl;
+ cout << "=================================================================" << endl;
+ cout << endl;
+ getData(user_string);
+ DisplayMenu(user_choice);
+ processChoice(user_choice, user_string);
+
+ return 0;
+
+}
+
+void getData(string& usr_data)
+{
+ cout << "Lets take a look at how to 'check' a string..." << endl;
+ cout << "Please enter a word: ";
+ cin >> usr_data;
+}
+
+
+void DisplayMenu(int& user_choice)
+{
+ cout << "Choose what you would like to check for in the string" << endl;
+ cout << "that you entered..." << endl;
+ cout << "=================================================================" << endl;
+ //displays the menu of functions for the user to choose from
+
+ cout << "1) Check for palindrome.\n";
+ cout << "2) Check for all alpha.\n";
+ cout << "3) Count the number of times a letter is in a word.\n";
+ cout << "4) Exit Program.\n\n";
+ cout << "Enter: ";
+ cin >> user_choice;
+ if (user_choice > 4 || user_choice< 1) {
+ cout << "Invalid Entry. Please enter a number from the options list provided.\n\n\n\n" << endl;
+ DisplayMenu(user_choice);
+ }
+}
+
+
+
+void ProcessMenuChoice (int menu_choice, string user_str) {
+ // Uses the user menu choice input to determine which function to call.
+ // Also controls the ending or restarting of program.
+ int program_rerun = 0;
+ switch(menu_choice){
+ case 1:
+ isPalindrome(user_str);
+ break;
+
+ case 2:
+ isAlpha(user_str);
+ break;
+
+ case 3:
+ countChar(user_str);
+ break;
+
+ case 4:
+ cout << "Are you sure you want to exit? Enter 1 to end program." << endl;
+ break;
+
+ default:
+ break;
+ }
+ cout << "Press 1 and enter to rerun program. Enter any other number to close program: ";
+ cin >> program_rerun;
+
+ if (program_rerun == 1)
+ main();
+ else {
+ cout << "================================================================" << endl;
+ cout << "Program Closing..." << endl;
+ cout << "================================================================\n\n\n" << endl;
+ }
+}
+
+
+
+void isPalindrome (string usr_data)
+{
+ cout << "is palindrome" << endl;
+}
+
+
+void isAlpha (string usr_data)
+{
+ cout << " alphabet check" << endl;
+}
+
+
+void countChar (string usr_data)
+{
+ cout << "Counting characters.." << endl;
+}
+
+
+
+
+