2. Write a program to act as a Russian Peasant Multiplication Calculator. This program should allow the user to carry out multiplication by just simply multiplying or dividing by 2 (and addition). It works as follows.
Start with two values, A and B. The goal is to multiply A by B. The first number, A, is successively divided by 2 while the second number, B, is multiplied by 2. If the number in the first column is odd, then the corresponding number in the second column is added to the sum. The final sum is the product, eg:
// ConsoleApplication15.cpp : Defines the entry point for the console application.
// My Program for Question 2 of my assignment
// Write a program to act as a Russian Peasant Multiplication Calculator. This program should allow the user to carry out multiplication by just simply multiplying or dividing by 2 (and addition). It works as follows.
// Start with two values, A and B. The goal is to multiply A by B. The first number, A, is successively divided by 2 while the second number, B, is multiplied by 2. If the number in the first column is odd, then the corresponding number in the second column is added to the sum. The final sum is the product, eg:
HWND hWnd = GetConsoleWindow(); // GetConsoleWindow function
ShowWindow(hWnd,SW_SHOWMAXIMIZED); // ShowWindow function
// variables
char answer;
do
{
int a, b, result;
a = 0;
b = 0;
result = 0;
// Prompt for first input
cout << "\n\n\tPlease enter your first number. ";
cin >> a;
// Prompt for second input
cout << "\n\n\tPlease enter your second number ";
cin >> b;