#include #include // this program asks the user for two three-digit numbers // and performs long multiplication on them. // e.g., for the input 123 and 456, the output should look like this: // // ___123 // x__456 // ------ // 738 // 615 // 492 // ------ // 56088 int main() { int n1, n2; int n2_100s_digit; int n2_10s_digit; int n2_1s_digit; cout << "Enter number 1: "; cin >> n1; cout << "Enter number 2: "; cin >> n2; // Print the first 3 rows: the 2 numbers and the row of dashes. // Note that it is not necessary to right justify the numbers // because that is the default setting. cout << setw(6) << setiosflags(ios::right) << n1 << endl; cout << "x" << setw(5) << setiosflags(ios::right) << n2 << endl; cout << "------" << endl; n2_100s_digit = n2 / 100; n2_10s_digit = (n2 / 10) % 10; n2_1s_digit = n2 % 10; cout << setw(6) << n2_1s_digit * n1 << endl; cout << setw(5) << n2_10s_digit * n1 << endl; cout << setw(4) << n2_100s_digit * n1 << endl; cout << "------" << endl; cout << setw(6) << n1 * n2 << endl; }