CSCI 261 - Programming Concepts (C++)Fall 2016 - Lab 03AQuick Links: Blackboard | EECS | Mines | Piazza | zyBooks |
||||||||||||||||||||||||||||
| Home | Contact | Syllabus | Assignments | Schedule | Resources | | ||||||||||||||||||||||||||||
This lab is due by September 14, 2016 08:00am.
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 Wednesday.
Instructions Create 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 ascendant or descendant.
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 ValuesHere 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 September 14, 2016 08:00am.
| ||||||||||||||||||||||||||||
Last Updated: 01/01/70 00:00
|