An example how to line up your decimal points in a column like output of floating point numbers. Both C and C++ versions are shown. Thanks are given to Bud Tugly, my 77 year old senior student.

// right justified numeric output  (Dev-C++)

#include <cstdlib>
#include <iostream>
#include <cstdio>      // for printf()
#include <iomanip>     // setXXX() functions

using namespace std;

int main()
{
  double d1 = 30.768;
  double d2 = 1.345;
  double d3 = .430;
  
  // this works well, the decimal points line up
  printf("%8.3f\n",d1);
  printf("%8.3f\n",d2);
  printf("%8.3f\n\n",d3); 

  // dito, but keep the order of setXXX() functions!!
  cout << setiosflags(ios::fixed);
  cout << setw(8) << setprecision(3) << d1 << endl;
  cout << setw(8) << setprecision(3) << d2 << endl; 
  cout << setw(8) << setprecision(3) << d3 << endl << endl; 
    
  system("PAUSE");
  return EXIT_SUCCESS;
}
The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.