diff options
| author | till-t <[email protected]> | 2021-10-26 18:00:41 -0700 |
|---|---|---|
| committer | till-t <[email protected]> | 2021-10-26 18:00:41 -0700 |
| commit | 49d9861f9e88f1b0036a016625341f9e8b7e75a6 (patch) | |
| tree | c91334c89bd13c17bdf9f0dfbf42d4d32bdda0a5 /CST116F2021-Lab4/lab4.cpp | |
| parent | End of day. Complete through 9.4 exercises. Next to be done is 9.5 exercises ... (diff) | |
| download | cst116-lab4-till-t-49d9861f9e88f1b0036a016625341f9e8b7e75a6.tar.xz cst116-lab4-till-t-49d9861f9e88f1b0036a016625341f9e8b7e75a6.zip | |
End of day. Completed all exercises.
Diffstat (limited to 'CST116F2021-Lab4/lab4.cpp')
| -rw-r--r-- | CST116F2021-Lab4/lab4.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/CST116F2021-Lab4/lab4.cpp b/CST116F2021-Lab4/lab4.cpp new file mode 100644 index 0000000..72cde42 --- /dev/null +++ b/CST116F2021-Lab4/lab4.cpp @@ -0,0 +1,32 @@ +// +// Created by Till on 20-Oct-21. +// + +#include <iostream> +#include <cmath> // needed for square roots +using namespace std; + +int avg_score (float& num1, float& num2, float& num3) +{ + int avg = 0; + avg = ( num1 + num2 + num3 ) / 3; + return avg; +} + +int main() { + + float value1, value2, value3, average = 0.0; + + cout << "Enter 3 values that you want averaged." << endl; + cout << "Enter value 1: " << endl; + cin >> value1; + cout << "Enter value 2: " << endl; + cin >> value2; + cout << "Enter value 3: " << endl; + cin >> value3; + + average = avg_score(value1, value2, value3); + cout << "Your average score is: " << average << endl; + + return 0; +} |