calc lowest eas230

calc lowest eas230 - endl; } } } // run forever } int...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> using namespace std; // functions int presentMenu( ); double getLowestLab( double score1, double score2, double score3 ); int main () { // variables double lab1 = -1, lab2 = -1, lab3 = -1; int userChoice = 99; double lowestLab = 100.0; while (true) { // repeat until quit userChoice = presentMenu( ); switch (userChoice) { case 1: { cout << "Enter Lab 1 score: "; cin >> lab1; break; } case 2: { cout << "Enter Lab 2 score: "; cin >> lab2; break; } case 3: { cout << "Enter Lab 3 score: "; cin >> lab3; break; } case 4: { lowestLab = getLowestLab( lab1, lab2, lab3 ); cout << endl << "Low Lab: " << lowestLab << endl; break; }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
case 5: { return 0; } default: { cout << "Invalid entry " << endl <<
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: endl; } } } // run forever } int presentMenu( ) { int selection = -1; cout &lt;&lt; &quot;*************&quot; &lt;&lt; endl; cout &lt;&lt; &quot;1. Enter Lab1&quot; &lt;&lt; endl; cout &lt;&lt; &quot;2. Enter Lab2&quot; &lt;&lt; endl; cout &lt;&lt; &quot;3. Enter Lab3&quot; &lt;&lt; endl; cout &lt;&lt; &quot;4. Get Lowest Lab&quot; &lt;&lt; endl; cout &lt;&lt; &quot;5. Quit&quot; &lt;&lt; endl &lt;&lt; endl; cout &lt;&lt; &quot;Enter choice, 1-5: &quot;; cin &gt;&gt; selection; cout &lt;&lt; endl; return selection; } double getLowestLab(double score1, double score2, double score3) { double minimum = 100.0; if (score1 &lt; minimum) { minimum = score1; } if (score2 &lt; minimum) { minimum = score2; } if (score3 &lt; minimum) { minimum = score3; } return minimum; }...
View Full Document

Page1 / 3

calc lowest eas230 - endl; } } } // run forever } int...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online