Added Files from Local to Repo
Added Project 1/Homework 1 and Lab 1. Modified the Lab 2 folder to match conventions.
This commit is contained in:
parent
dea1f746be
commit
7452a9ca4f
11 changed files with 2219 additions and 56 deletions
|
|
@ -1,57 +0,0 @@
|
|||
// This is lab2 for CS136L
|
||||
// By Andrew Angus and Charles Descamps
|
||||
|
||||
// include files
|
||||
#include "Console_IO_Utility.h"
|
||||
#include "StandardConstants.h"
|
||||
|
||||
//global constants
|
||||
// this constant is to adjust input to accomodate the 0.45 rounding
|
||||
const double CHANGE_IN_DECIMAL = 0.55;
|
||||
const int MULTIPLE_LINE_SPACES = 2;
|
||||
const int LENGTH_OF_SEPERATOR = 16;
|
||||
|
||||
// main program
|
||||
int main()
|
||||
{
|
||||
|
||||
// initialize variables
|
||||
double valueToRound;
|
||||
|
||||
// prints the intro
|
||||
printEndline();
|
||||
|
||||
// need to print the title of the program.
|
||||
printString("Rounding Program");
|
||||
|
||||
// prints another blank line
|
||||
printEndline();
|
||||
|
||||
// also print a separator (16 equal signs)
|
||||
printCharacters(LENGTH_OF_SEPERATOR, '=');
|
||||
|
||||
// another blank line
|
||||
printEndlines(MULTIPLE_LINE_SPACES);
|
||||
|
||||
// Ask user for the value to round
|
||||
valueToRound = promptForDouble("Enter a value to be rounded: ");
|
||||
|
||||
// Round the value by adding change in decimal, then round
|
||||
valueToRound += CHANGE_IN_DECIMAL;
|
||||
valueToRound = (int)valueToRound;
|
||||
valueToRound = (double)valueToRound;
|
||||
|
||||
// print out the rounded value
|
||||
printString("The rounded value is now: ");
|
||||
printDouble(valueToRound, PRECISION);
|
||||
|
||||
// print another blank line
|
||||
printEndlines(MULTIPLE_LINE_SPACES);
|
||||
|
||||
// Print "Program End"
|
||||
printString("Program End");
|
||||
|
||||
// print another new line.
|
||||
printEndline();
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue