I need to multiply two 3 digit numbers and have the lines lay out in the 1\'s 10
ID: 3638687 • Letter: I
Question
I need to multiply two 3 digit numbers and have the lines lay out in the 1's 10's and 100's column before the sum appears. As if you were calculating it on paper. This is what I have so far. I can get it to find the sum but, i can figure out how to get it to show the process to get the sum. I also cant seem to insert the setw() feature in the program without it freaking out. The answer needs to look something like this ( i hope it shows up the way i need it to after posting)111
x222
--------
333
444
555
--------
66666
This is my program so far. Any HELP!!! would be GREAT haha. Thank you.
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
char one [3], two[3];
int first = 0; // first set of integers
int second= 0; // second set of integers
int sum = 0;
cout << "This Program Will Multiply two 3-digit Numbers ";
cout << "Enter your first number: ";
cin >> one;
first = atoi(one);
cout << "Enter you second number: ";
cin >> two;
second = atoi(two);
sum = ( first * second );
cout << " ";
cout << first << " X " << second << " ----- " << sum << endl;
system ("PAUSE");
return 0;
}
Explanation / Answer
You think something like this