Cleaning up my output

I know how to get the numbers to move but nothing else.

I am try to do it with setw but I cannot figure out how to do it.

My code for the output:
1
2
3
4
5
6
7
8
9
cout << fixed << showpoint;
cout << fixed << setprecision(1);

cout << border << endl;
cout << "Quadratic Formula" << endl;
cout << "\na = " << a << " b = " << b << " c = " << c << endl;
cout << "\nWhen adding the discriminant x = " << addDiscriminant << endl;
cout << "When subtracting the discriminant x = " << subtractDiscriminant << endl;
   cout << border << endl;




What my code look like now:
1
2
3
4
5
6
7
8
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Quadratic Formula

a = 2 b = -4 c = -16

When adding the discriminant x = 4.0
When subtracting the discriminant x = -2.0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


What I want it to look like:
1
2
3
4
5
6
7
8
9
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                Quadratic Formula

          a = 2      b = -4       c = -16

     When adding the discriminant x = 4.0
     When subtracting the discriminant x = -2.0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1
2
3
4
5
6
cout << border << endl;
cout << "\t\t\tQuadratic Formula" << endl;
cout << "\n\t\ta = " << a << "\tb = " << b << "\tc = " << c << endl;
cout << "\n\tWhen adding the discriminant x = " << addDiscriminant << endl;
cout << "\tWhen subtracting the discriminant x = " << subtractDiscriminant << endl;
cout << border << endl;


Maybe that is more like what you want. All I did was add in the escape character for a tab, "\t". It won't perfectly center your code, but it will help it be indented a little.
Topic archived. No new replies allowed.