calc lowest eas230

calc lowest eas230 - endl run forever int presentMenu 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 Document Right 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 << "*************" << endl; cout << "1. Enter Lab1" << endl; cout << "2. Enter Lab2" << endl; cout << "3. Enter Lab3" << endl; cout << "4. Get Lowest Lab" << endl; cout << "5. Quit" << endl << endl; cout << "Enter choice, 1-5: "; cin >> selection; cout << endl; return selection; } double getLowestLab(double score1, double score2, double score3) { double minimum = 100.0; if (score1 < minimum) { minimum = score1; } if (score2 < minimum) { minimum = score2; } if (score3 < minimum) { minimum = score3; } return minimum; }...
View Full Document

{[ snackBarMessage ]}

Page1 / 3

calc lowest eas230 - endl run forever int presentMenu 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