As of now my program as the user input an expression like *2x and then the program outputs it as
*
2
x
I am wanting to display zeros next to the elements, 2 columns of zeros so the output will be
* 0 0
2 0 0
x 0 0
This is my code
Code:
int main()
{
string s;
cout << "Input the prefix expression.\n" ;
cin >> s;
cout << "The expression tree is:\n" ;
int row = s.length();
int col = 2;
int array[row][col];
int i, j, c;
for (j = 0; j < row; j++)
for (c = 0; c < col; c++)
for (i = 0; i < s.length(); i++)
{
cout << s[i] << array[row][col] << endl ;
}
it outputs
*2293584
22293584
x2293584
*2293584
22293584
x2293584
*2293584
22293584
x2293584
*2293584
22293584
x2293584
Edit/Delete Message