char miscToolsOp(char ov_menu_input, char *ov_uid, bool CHECK) { switch (ov_menu_input) { case 'e': stdExit(ov_uid); break; case 'p': ov_menu_input = celfahMiscTool(ov_menu_input, CHECK, ov_uid); break; case 'm': ov_menu_input = multiplicationTable(ov_uid, ov_menu_input); break; case 'r': ov_menu_input = repeatMe(ov_menu_input, ov_uid); break; case 'a': ov_menu_input = markAverageSum(ov_menu_input, ov_uid); break; } return (ov_menu_input); }
// You should study and understand how this main function works. // Do not modify it in any way, there is no implementation needed here. void main() { int selection; // used for program selection char input[32]; // used for encryption int encrypt; // used for encryption char strings[5][32]; // used for sorting int num; // used for multiplication table int mt[50][50]; // used for multiplication table printf("Select one of the following:\n"); // prompt for program selection integer printf("1: Encryption\n"); printf("2. Sorting\n"); printf("3. Multiplication Table\n"); scanf("%d", &selection); // store program selection integer getchar(); // consume '\n' char; NOTE: If you are using GCC, you may need to comment out this line printf("\n"); // newline switch (selection) { case 1: printf("Enter a string up to 20 characters long: "); // prompt for string fgets(input, sizeof(input), stdin); // store string input[strlen(input) - 1] = '\0'; // discard '\n' char; NOTE: If you are using GCC, you may need to comment out this line printf("Enter an Integer value for Encryption: "); // prompt for integer scanf("%d", &encrypt); // store integer encryption(input, 2); // encrypt string printf("\nEncrypted String: %s\n", input); // print encrypted string decryption(input, 2); // encrypt string printf("Decrypted String: %s\n", input); // print decrypted string break; case 2: printf("Enter the first String: "); // prompt for string fgets(strings[0], sizeof(strings[0]), stdin); // store string printf("Enter the second String: "); fgets(strings[1], sizeof(strings[1]), stdin); printf("Enter the third String: "); fgets(strings[2], sizeof(strings[2]), stdin); printf("Enter the fourth String: "); fgets(strings[3], sizeof(strings[3]), stdin); printf("Enter the fifth String: "); fgets(strings[4], sizeof(strings[4]), stdin); sortStrings(strings); // call sorting function // print strings in sorted order printf("\nSorted Strings:\n%s%s%s%s%s", strings[0], strings[1], strings[2], strings[3], strings[4]); break; case 3: printf("Enter an integer 1-50 for a multiplication table: "); // prompt for integer scanf("%d", &num); // store integer multiplicationTable(mt, num); // create multiplication table printf("\n"); // newline printMultiplicationTable(mt, num); // print multiplication table } }