COSC1315 Fundamentals of Programming

Instructor:  Prof. Richard G. Baldwin

Assignment Number:  02

Non Object-Based program to display data in columns of different widths and differing precision using iomanip and manipulators.

Making certain that you comply with the General Requirements, write a C++ program that meets the following specifications:

BEGIN WRITTEN SPECIFICATIONS

This program does not require the use of Object-Based Programming Syntax.

Write a program that begins by displaying you name on the first line as shown below.

Then it displays the upper-case alphabet on the second line as shown below.

Then it displays the value 1.23456789 ten times in succession, twice per line on the next five lines.  This must produce the screen output shown below. 

Make certain that your numbers line up under the alphabetic characters as shown.

Use the cout object and the insertion operator to produce the screen output. 

You may not insert any space characters into the cout object.  In every case where the value is to be displayed, you must insert the full nine-digit value, 1.23456789, into the cout object

Program Output:

Display your name here
ABCDEFGHIJKLMNOPQRSTUVWXYZ
     1.2  1.23
    1.23  1.235
   1.235  1.2346
  1.2346  1.23457
 1.23457  1.234568

END WRITTEN SPECIFICATIONS

As specified in the General Requirements, copy the above specifications, including the two lines of upper-case characters and paste the specifications into a comment block at the beginning of your source code file.

Note:  Sometimes when copying C++ source code into HTML documents (like this one) the code will become corrupted.  This is particularly true for code that involves left and right angle brackets such as in:

#include <iostream>
if(x <= y){

Although Prof. Baldwin has made an effort avoid such problems, it is possible that some corruption of source code may have occurred during the creation of these HTML documents.  If you see anything that you believe might be corrupted source code, please notify Prof. Baldwin so that he can look into the problem, correct the code if necessary, and make all of the students aware of the problem.

-end-