aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortill-t <[email protected]>2021-11-08 13:52:31 -0800
committertill-t <[email protected]>2021-11-08 13:52:31 -0800
commit3cd73399b8db18d8f196531834eb6cf6c963de91 (patch)
treef59c2a5a022315aef7e4e2bd811a260b2ccc3f5f
parentNovember 8, 2021 (diff)
downloadcst116proj2-tyisabella-3cd73399b8db18d8f196531834eb6cf6c963de91.tar.xz
cst116proj2-tyisabella-3cd73399b8db18d8f196531834eb6cf6c963de91.zip
Nov 8, 2021 Tyler
Processing running. Need tables, and find position and num digits. Tyler
-rw-r--r--src.cpp61
1 files changed, 55 insertions, 6 deletions
diff --git a/src.cpp b/src.cpp
index 1baecee..29755ac 100644
--- a/src.cpp
+++ b/src.cpp
@@ -16,8 +16,12 @@ void IsPosNeg (int);
void IsOddEven (int);
int main() {
- int User_Value = 2;
- IsOddEven(User_Value);
+ int User_Value = 0;
+ int Menu_choice = 0;
+ User_Value = GetData();
+ DisplayMenu(Menu_choice);
+ ProcessMenuChoice(Menu_choice, User_Value);
+
return 0;
}
@@ -26,8 +30,12 @@ int main() {
int GetData(){
//receives input from user within negative million and positive million.
int usr_data = 0;
+ cout << "================================================================" << endl;
+ cout << "Program Running..." << endl;
+ cout << "================================================================\n\n\n" << endl;
+
- cout << "Please enter the number you would like to tested: ";
+ cout << "Please enter the number you would like to have tested: ";
cin >> usr_data;
if (usr_data < -1000000 || usr_data > 1000000 ){
@@ -46,19 +54,60 @@ void DisplayMenu(int& menu_choice) {
cout << "3) Determine the number of digits in the entered number.\n";
cout << "4) Determine what digit is at a given position in the number.\n";
cout << "5) Display Addition Table.\n";
- cout << "6) Display Multiplication Table.";
+ cout << "6) Display Multiplication Table.\n";
cout << "7) Exit Program.\n\n";
cout << "Enter: ";
cin >> menu_choice;
if (menu_choice > 7 || menu_choice < 1) {
- cout << "Invalid Entry. Please enter a number from the options list provided." << endl;
+ cout << "Invalid Entry. Please enter a number from the options list provided.\n\n\n\n" << endl;
DisplayMenu(menu_choice);
}
}
void ProcessMenuChoice (int menu_choice, int& usr_data) {
- cout << "Processing.";
+ int program_rerun = 0;
+ switch(menu_choice){
+ case 1:
+ IsPosNeg(usr_data);
+ break;
+
+ case 2:
+ IsOddEven(usr_data);
+ break;
+
+ case 3:
+ cout << "Find num digits" << endl;
+ break;
+
+ case 4:
+ cout << "Find digit at position" << endl;
+ break;
+
+ case 5:
+ cout << "Display addition table" << endl;
+ break;
+
+ case 6:
+ cout << "Display multiplication table" << endl;
+ break;
+
+ case 7:
+ cout << "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();
+
+ cout << "================================================================" << endl;
+ cout << "Program Closing..." << endl;
+ cout << "================================================================\n\n\n" << endl;
}