aboutsummaryrefslogtreecommitdiff
path: root/CST116F2021-Lab4/lab4.cpp
blob: 72cde42d4c178e6b15efcf4e8db4724e73c5142d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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;
}