Marcus wants to create a program that helps his kids learn some basic number manipulations. He started the program but got frustrated and asked you to help him out. Here is what he has so far:
#include
using namespace std;
int main()
{
int menu_choice;
int number;
cout << "Enter number: ";
cin >> number;
cout << "1) Is the number odd or even? /n"
<< "2) Is the number positive or negative? /n";
<< "3) What is the square root of the number? /n/n;
cout << "Enter a menu choice: ";
cin >> menu_choice;
if (menu_choice = 1)
// Process
// Display odd, even, or zero
if (menu_choice == 2)
// Process
// Display positive, negative or zero
if (menu_choice == 3);
// Process
// Display square foot
return 0;
}
As you can see, He didn’t get very far before he gave up. To help him out, convert Marcus’s if statements to a more efficient switch statement. Also, complete the necessary number manipulations. Remember, even though that you are jumping into the middle of a program that is already written (well, almost), don’t forget the development process.
Marcus would like you to expand what you did to include the following functionality.
How many digits are in a number? HINT: Repeatedly divide the number by 10, keeping track of the number of times you divide.
What digit is at a specific position?
Display an addition table for all numbers up to 12.
Display a multiplication table for all numbers up to 12.
Include your pseudocode.