CSCI 261 - Programming Concepts (C++)Spring 2017 - Lab 03AQuick Links: Blackboard | Canvas | CS @ Mines | Cloud9 | Piazza | zyBooks |
||||||||||||||||||||||||||||
| Home | Contact | Syllabus | Assignments | Schedule | Resources | | ||||||||||||||||||||||||||||
This lab is due by
January 31, 2017 11:59pm.
Triangle ClassifierThe goal of this lab is to practice
the use of if-else statements by classifying triangles based on their
sides. It will also teach you how to correctly compare two double
variables for equality using a tolerance factor. Your solution will be
submitted with Week03 next Tuesday.
InstructionsCreate yourself an empty project.
Since we assume you have been doing our class assignments, we assume
you know how to do this by now. Call this project Lab03A.
Write code to first read three real value measurements, i.e., your
program should prompt the user to enter the three real values (which
should be stored as three double variables). Once done, write code to
determine whether the three real value measurements make a triangle. If
yes, your program should tell the user whether the triangle is a right,
acute, or obtuse triangle (see hints below). If
no, your program should politely terminate with an appropriate error
message.
The user should be allowed to enter
the three real values in any order; in other words, your program should
not assume any particular input order such as ascending or descending.
Hints
// The fabs function (defined in cmath) returns the absolute value of
a given floating point number.
// Thus, if the following equation is true, then we assume a2 + b2 == c2. fabs(a2 + b2 - c2) <= TOLERANCE Test Values
Here are some known input/output values that you can test against. Be sure to try your own to verify
the code works!
Lab Submission
You will submit your solution to this lab with the rest of Week03.
Detailed instructions for doing this are posted in Assignment 03.
This lab is due by
January 31, 2017 11:59pm.
| ||||||||||||||||||||||||||||
Last Updated: 01/01/70 00:00
|