{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

calc lowest arrays eas 230

# calc lowest arrays eas 230 - default...

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

#include <iostream> using namespace std; // functions int presentMenu( ); double getLowestLab( ); // define lab variables OUTSIDE of main as GLOBAL variables double lab1 = -1, lab2 = -1, lab3 = -1; int main () { // variables 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( ); cout << endl << "Low Lab: " << lowestLab << endl; break; }

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

View Full Document
case 5: { return 0;
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } default: { cout << "Invalid entry " << endl << 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 minimum = 100; if (lab1 < minimum) { minimum = lab1; } if (lab2 < minimum) { minimum = lab2; } if (lab3 < minimum) { minimum = lab3; } return minimum; }...
View Full Document

{[ snackBarMessage ]}

### Page1 / 3

calc lowest arrays eas 230 - default...

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

View Full Document
Ask a homework question - tutors are online