Not much emphasis is placed on console output when programming with a .Net language like c#. However, console output has a number of useful purposes when performing a variety of numeric calculations. The number one reason I like using console output is being able to redirect the output to a file. Another nice feature of console output is speed. There is very little overhead associated with dumping large amounts of data to the console. Coupled with I/O redirection in the command window, you can save yourself a lot of coding and debugging time.
I've been spending time learning the in's and out's of console output because I am porting some native FORTRAN and C++ code using cout. You can reproduce most of the FORTRAN and C++ output functionality with very little effort.
In native C++, the console output fragment
cout << setw(10) << x
<< setw(10) << y
<< setw(10) << a
<< setw(10) << b
<< setw(14) << cdf_lookup
<< setw(14) << cdf_compute << endl;
might easily be translated to something like the following when porting to managed code:
Object[] o = { x, y, a, b, cdf_lookup, cdf_compute };
Console.WriteLine("{0,10:0.000000} {1,10:0.000000} {2,10:0.000000} {3,10:0.000000} {4,14:0.000000} {5,14:0.000000}", o);
It's worth it to take some time and experiment with formatting strings and console output.
For instance, if we change the output field {0,10:0.000000} to {0,-10:0.000000}, then the number will be left aligned when it is printed. Changing the custom format string to 0.0##### will cause the numeric output to display at least 1 digit past the decimal point; the runtime will use as many digits as necessary (up to six) for the decimal fraction if necessary. If the numeric field is right aligned, then decimal points may not line up properly when using a custom string like 0.0#####. It is generally better to use a format string like 0.000000 when printing rows of numbers where the decimal points should line up and right aligned formatting is used.