CSCI 261 - Programming Concepts (C++)

Spring 2018 - Lab 2B

Quick Links: Canvas | CS @ Mines | Cloud9 | Piazza | zyBooks

|   Home |  Contact |  Syllabus |  Assignments |  Schedule |  Resources   |
This lab is due by Tuesday, January 30, 2018 11:59 PM .

Make it look pretty!



At the end of Lab2A, our program output looked something like:

Enter the acceleration: 4.33
Enter the mass: 9.3
The force is: 40.269
Enter the width: 4
Enter the height: 2
The area is: 8

Which works, but we'd like to be more precise and make values easier to read. Specifically, we want to always display three decimal places and align the decimal points when outputting the results. Using the appropriate I/O manipulators, modify your program from Lab2A to match the following template:

Enter the acceleration: 4.33
Enter the mass: 9.3

Enter the width: 4
Enter the height: 2

Equation #01...Newton's 2nd Law (Physics): 40.269
Equation #12...............Area (Math)   :  8.000

Where the #nn displayed corresponds to the number of the equation from the table. Then fill the space to right align the equation names followed by the major the equation relates to. The colons and decimal points should be aligned with three decimal places following. You'll need to use a combination of I/O manipulators and turn settings on/off to accomplish this task.


Lab Submission



You will submit your solution to this lab with the second homework assignment. Detailed instructions for doing this are posted in Assignment 2.


This lab is due by Tuesday, January 30, 2018 11:59 PM .
Last Updated: 01/08/18 15:26


Valid HTML 4.01 Strict Valid CSS! Level Triple-A conformance, W3C WAI Web Content Accessibility Guidelines 2.0